
#include "main.h"

//${CONFIG_BEGIN}
#define CFG_BINARY_FILES |*.obj|*.b3d|*.mtl
#define CFG_BRL_DATABUFFER_IMPLEMENTED 1
#define CFG_BRL_GAMETARGET_IMPLEMENTED 1
#define CFG_BRL_SOCKET_IMPLEMENTED 1
#define CFG_BRL_THREAD_IMPLEMENTED 1
#define CFG_CONFIG debug
#define CFG_CPP_GC_MODE 1
#define CFG_GLFW_SWAP_INTERVAL -1
#define CFG_GLFW_USE_MINGW 1
#define CFG_GLFW_WINDOW_FULLSCREEN 0
#define CFG_GLFW_WINDOW_HEIGHT 480
#define CFG_GLFW_WINDOW_RESIZABLE 0
#define CFG_GLFW_WINDOW_TITLE Monkey Game
#define CFG_GLFW_WINDOW_WIDTH 640
#define CFG_HOST winnt
#define CFG_IMAGE_FILES *.png|*.jpg
#define CFG_LANG cpp
#define CFG_MINIB3D_DEBUG_MODEL 0
#define CFG_MINIB3D_DRIVER 
#define CFG_MOJO_AUTO_SUSPEND_ENABLED 1
#define CFG_MOJO_DRIVER_IMPLEMENTED 1
#define CFG_MOJO_IMAGE_FILTERING_ENABLED 1
#define CFG_MUSIC_FILES *.wav|*.ogg
#define CFG_OPENGL_DEPTH_BUFFER_ENABLED 1
#define CFG_OPENGL_GLES20_ENABLED 0
#define CFG_OPENGL_INIT_EXTENSIONS 1
#define CFG_SAFEMODE 0
#define CFG_SOUND_FILES *.wav|*.ogg
#define CFG_TARGET glfw
#define CFG_TEXT_FILES *.txt|*.xml|*.xrf|*.xaf|*.xmf|*.xaf|*.xsf
//${CONFIG_END}

//${TRANSCODE_BEGIN}

#include <wctype.h>
#include <locale.h>

// C++ Monkey runtime.
//
// Placed into the public domain 24/02/2011.
// No warranty implied; use at your own risk.

//***** Monkey Types *****

typedef wchar_t Char;
template<class T> class Array;
class String;
class Object;

#if CFG_CPP_DOUBLE_PRECISION_FLOATS
typedef double Float;
#define FLOAT(X) X
#else
typedef float Float;
#define FLOAT(X) X##f
#endif

void dbg_error( const char *p );

#if !_MSC_VER
#define sprintf_s sprintf
#define sscanf_s sscanf
#endif

//***** GC Config *****

#define DEBUG_GC 0

// GC mode:
//
// 0 = disabled
// 1 = Incremental GC every OnWhatever
// 2 = Incremental GC every allocation
//
#ifndef CFG_CPP_GC_MODE
#define CFG_CPP_GC_MODE 1
#endif

//How many bytes alloced to trigger GC
//
#ifndef CFG_CPP_GC_TRIGGER
#define CFG_CPP_GC_TRIGGER 8*1024*1024
#endif

//GC_MODE 2 needs to track locals on a stack - this may need to be bumped if your app uses a LOT of locals, eg: is heavily recursive...
//
#ifndef CFG_CPP_GC_MAX_LOCALS
#define CFG_CPP_GC_MAX_LOCALS 8192
#endif

// ***** GC *****

#if _WIN32

int gc_micros(){
	static int f;
	static LARGE_INTEGER pcf;
	if( !f ){
		if( QueryPerformanceFrequency( &pcf ) && pcf.QuadPart>=1000000L ){
			pcf.QuadPart/=1000000L;
			f=1;
		}else{
			f=-1;
		}
	}
	if( f>0 ){
		LARGE_INTEGER pc;
		if( QueryPerformanceCounter( &pc ) ) return pc.QuadPart/pcf.QuadPart;
		f=-1;
	}
	return 0;// timeGetTime()*1000;
}

#elif __APPLE__

#include <mach/mach_time.h>

int gc_micros(){
	static int f;
	static mach_timebase_info_data_t timeInfo;
	if( !f ){
		mach_timebase_info( &timeInfo );
		timeInfo.denom*=1000L;
		f=1;
	}
	return mach_absolute_time()*timeInfo.numer/timeInfo.denom;
}

#else

int gc_micros(){
	return 0;
}

#endif

#define gc_mark_roots gc_mark

void gc_mark_roots();

struct gc_object;

gc_object *gc_object_alloc( int size );
void gc_object_free( gc_object *p );

struct gc_object{
	gc_object *succ;
	gc_object *pred;
	int flags;
	
	virtual ~gc_object(){
	}
	
	virtual void mark(){
	}
	
	void *operator new( size_t size ){
		return gc_object_alloc( size );
	}
	
	void operator delete( void *p ){
		gc_object_free( (gc_object*)p );
	}
};

gc_object gc_free_list;
gc_object gc_marked_list;
gc_object gc_unmarked_list;
gc_object gc_queued_list;	//doesn't really need to be doubly linked...

int gc_free_bytes;
int gc_marked_bytes;
int gc_alloced_bytes;
int gc_max_alloced_bytes;
int gc_new_bytes;
int gc_markbit=1;

gc_object *gc_cache[8];

int gc_ctor_nest;
gc_object *gc_locals[CFG_CPP_GC_MAX_LOCALS],**gc_locals_sp=gc_locals;

void gc_collect_all();
void gc_mark_queued( int n );

#define GC_CLEAR_LIST( LIST ) ((LIST).succ=(LIST).pred=&(LIST))

#define GC_LIST_IS_EMPTY( LIST ) ((LIST).succ==&(LIST))

#define GC_REMOVE_NODE( NODE ){\
(NODE)->pred->succ=(NODE)->succ;\
(NODE)->succ->pred=(NODE)->pred;}

#define GC_INSERT_NODE( NODE,SUCC ){\
(NODE)->pred=(SUCC)->pred;\
(NODE)->succ=(SUCC);\
(SUCC)->pred->succ=(NODE);\
(SUCC)->pred=(NODE);}

void gc_init1(){
	GC_CLEAR_LIST( gc_free_list );
	GC_CLEAR_LIST( gc_marked_list );
	GC_CLEAR_LIST( gc_unmarked_list);
	GC_CLEAR_LIST( gc_queued_list );
}

void gc_init2(){
	gc_mark_roots();
}

#if CFG_CPP_GC_MODE==2

struct gc_ctor{
	gc_ctor(){ ++gc_ctor_nest; }
	~gc_ctor(){ --gc_ctor_nest; }
};

struct gc_enter{
	gc_object **sp;
	gc_enter():sp(gc_locals_sp){
	}
	~gc_enter(){
	/*
		static int max_locals;
		int n=gc_locals_sp-gc_locals;
		if( n>max_locals ){
			max_locals=n;
			printf( "max_locals=%i\n",n );
		}
	*/
		gc_locals_sp=sp;
	}
};

#define GC_CTOR gc_ctor _c;
#define GC_ENTER gc_enter _e;

#else

struct gc_ctor{
};
struct gc_enter{
};

#define GC_CTOR
#define GC_ENTER

#endif

void gc_flush_free( int size ){

	int t=gc_free_bytes-size;
	if( t<0 ) t=0;
	
	while( gc_free_bytes>t ){
		gc_object *p=gc_free_list.succ;
		if( !p || p==&gc_free_list ){
//			printf("ERROR:p=%p gc_free_bytes=%i\n",p,gc_free_bytes);
//			fflush(stdout);
			gc_free_bytes=0;
			break;
		}
		GC_REMOVE_NODE(p);
		delete p;	//...to gc_free
	}
}

void *gc_ext_malloc( int size ){

	gc_new_bytes+=size;
	
	gc_flush_free( size );
	
	return malloc( size );
}

void gc_ext_malloced( int size ){

	gc_new_bytes+=size;
	
	gc_flush_free( size );
}

gc_object *gc_object_alloc( int size ){

	size=(size+7)&~7;
	
#if CFG_CPP_GC_MODE==1

	gc_new_bytes+=size;
	
#elif CFG_CPP_GC_MODE==2

	if( !gc_ctor_nest ){
#if DEBUG_GC
		int ms=gc_micros();
#endif
		if( gc_new_bytes+size>(CFG_CPP_GC_TRIGGER) ){
			gc_collect_all();
			gc_new_bytes=size;
		}else{
			gc_new_bytes+=size;
			gc_mark_queued( (long long)(gc_new_bytes)*(gc_alloced_bytes-gc_new_bytes)/(CFG_CPP_GC_TRIGGER)+gc_new_bytes );
		}
		
#if DEBUG_GC
		ms=gc_micros()-ms;
		if( ms>=100 ) {printf( "gc time:%i\n",ms );fflush( stdout );}
#endif
	}

#endif

	gc_flush_free( size );

	gc_object *p;
	if( size<64 && (p=gc_cache[size>>3]) ){
		gc_cache[size>>3]=p->succ;
	}else{
		p=(gc_object*)malloc( size );
	}
	
	p->flags=size|gc_markbit;
	GC_INSERT_NODE( p,&gc_unmarked_list );

	gc_alloced_bytes+=size;
	if( gc_alloced_bytes>gc_max_alloced_bytes ) gc_max_alloced_bytes=gc_alloced_bytes;
	
#if CFG_CPP_GC_MODE==2
	*gc_locals_sp++=p;
#endif

	return p;
}

void gc_object_free( gc_object *p ){

	int size=p->flags & ~7;
	gc_free_bytes-=size;
	
	if( size<64 ){
		p->succ=gc_cache[size>>3];
		gc_cache[size>>3]=p;
	}else{
		free( p );
	}
}

template<class T> void gc_mark( T *t ){

	gc_object *p=dynamic_cast<gc_object*>(t);
	
	if( p && (p->flags & 3)==gc_markbit ){
		p->flags^=1;
		GC_REMOVE_NODE( p );
		GC_INSERT_NODE( p,&gc_marked_list );
		gc_marked_bytes+=(p->flags & ~7);
		p->mark();
	}
}

template<class T> void gc_mark_q( T *t ){

	gc_object *p=dynamic_cast<gc_object*>(t);
	
	if( p && (p->flags & 3)==gc_markbit ){
		p->flags^=1;
		GC_REMOVE_NODE( p );
		GC_INSERT_NODE( p,&gc_queued_list );
	}
}

template<class T> T *gc_retain( T *t ){
#if CFG_CPP_GC_MODE==2
	*gc_locals_sp++=dynamic_cast<gc_object*>( t );
#endif	
	return t;
}

template<class T,class V> void gc_assign( T *&lhs,V *rhs ){
	gc_object *p=dynamic_cast<gc_object*>(rhs);
	if( p && (p->flags & 3)==gc_markbit ){
		p->flags^=1;
		GC_REMOVE_NODE( p );
		GC_INSERT_NODE( p,&gc_queued_list );
	}
	lhs=rhs;
}

void gc_mark_locals(){
	for( gc_object **pp=gc_locals;pp!=gc_locals_sp;++pp ){
		gc_object *p=*pp;
		if( p && (p->flags & 3)==gc_markbit ){
			p->flags^=1;
			GC_REMOVE_NODE( p );
			GC_INSERT_NODE( p,&gc_marked_list );
			gc_marked_bytes+=(p->flags & ~7);
			p->mark();
		}
	}
}

void gc_mark_queued( int n ){
	while( gc_marked_bytes<n && !GC_LIST_IS_EMPTY( gc_queued_list ) ){
		gc_object *p=gc_queued_list.succ;
		GC_REMOVE_NODE( p );
		GC_INSERT_NODE( p,&gc_marked_list );
		gc_marked_bytes+=(p->flags & ~7);
		p->mark();
	}
}

//returns reclaimed bytes
int gc_sweep(){

	int reclaimed_bytes=gc_alloced_bytes-gc_marked_bytes;
	
	if( reclaimed_bytes ){
	
		//append unmarked list to end of free list
		gc_object *head=gc_unmarked_list.succ;
		gc_object *tail=gc_unmarked_list.pred;
		gc_object *succ=&gc_free_list;
		gc_object *pred=succ->pred;
		head->pred=pred;
		tail->succ=succ;
		pred->succ=head;
		succ->pred=tail;
		
		gc_free_bytes+=reclaimed_bytes;
	}
	
	//move marked to unmarked.
	gc_unmarked_list=gc_marked_list;
	gc_unmarked_list.succ->pred=gc_unmarked_list.pred->succ=&gc_unmarked_list;
	
	//clear marked.
	GC_CLEAR_LIST( gc_marked_list );
	
	//adjust sizes
	gc_alloced_bytes=gc_marked_bytes;
	gc_marked_bytes=0;
	gc_markbit^=1;
	
	return reclaimed_bytes;
}

void gc_collect_all(){

//	printf( "Mark locals\n" );fflush( stdout );
	gc_mark_locals();

//	printf( "Mark queued\n" );fflush( stdout );
	gc_mark_queued( 0x7fffffff );

//	printf( "sweep\n" );fflush( stdout );	
	gc_sweep();

//	printf( "Mark roots\n" );fflush( stdout );
	gc_mark_roots();

#if DEBUG_GC	
	printf( "gc collected:%i\n",reclaimed );fflush( stdout );
#endif
}

void gc_collect(){

	if( gc_locals_sp!=gc_locals ){
//		printf( "GC_LOCALS error\n" );fflush( stdout );
		gc_locals_sp=gc_locals;
	}
	
#if CFG_CPP_GC_MODE==1

#if DEBUG_GC
	int ms=gc_micros();
#endif

	if( gc_new_bytes>(CFG_CPP_GC_TRIGGER) ){
		gc_collect_all();
		gc_new_bytes=0;
	}else{
		gc_mark_queued( (long long)(gc_new_bytes)*(gc_alloced_bytes-gc_new_bytes)/(CFG_CPP_GC_TRIGGER)+gc_new_bytes );
	}

#if DEBUG_GC
	ms=gc_micros()-ms;
	if( ms>=100 ) {printf( "gc time:%i\n",ms );fflush( stdout );}
#endif

#endif

}

// ***** Array *****

template<class T> T *t_memcpy( T *dst,const T *src,int n ){
	memcpy( dst,src,n*sizeof(T) );
	return dst+n;
}

template<class T> T *t_memset( T *dst,int val,int n ){
	memset( dst,val,n*sizeof(T) );
	return dst+n;
}

template<class T> int t_memcmp( const T *x,const T *y,int n ){
	return memcmp( x,y,n*sizeof(T) );
}

template<class T> int t_strlen( const T *p ){
	const T *q=p++;
	while( *q++ ){}
	return q-p;
}

template<class T> T *t_create( int n,T *p ){
	t_memset( p,0,n );
	return p+n;
}

template<class T> T *t_create( int n,T *p,const T *q ){
	t_memcpy( p,q,n );
	return p+n;
}

template<class T> void t_destroy( int n,T *p ){
}

template<class T> void gc_mark_elements( int n,T *p ){
}

template<class T> void gc_mark_elements( int n,T **p ){
	for( int i=0;i<n;++i ) gc_mark( p[i] );
}

template<class T> class Array{
public:
	Array():rep( &nullRep ){
	}

	//Uses default...
//	Array( const Array<T> &t )...
	
	Array( int length ):rep( Rep::alloc( length ) ){
		t_create( rep->length,rep->data );
	}
	
	Array( const T *p,int length ):rep( Rep::alloc(length) ){
		t_create( rep->length,rep->data,p );
	}
	
	~Array(){
	}

	//Uses default...
//	Array &operator=( const Array &t )...
	
	int Length()const{ 
		return rep->length; 
	}
	
	T &At( int index ){
		if( index<0 || index>=rep->length ) dbg_error( "Array index out of range" );
		return rep->data[index]; 
	}
	
	const T &At( int index )const{
		if( index<0 || index>=rep->length ) dbg_error( "Array index out of range" );
		return rep->data[index]; 
	}
	
	T &operator[]( int index ){
		return rep->data[index]; 
	}

	const T &operator[]( int index )const{
		return rep->data[index]; 
	}
	
	Array Slice( int from,int term )const{
		int len=rep->length;
		if( from<0 ){ 
			from+=len;
			if( from<0 ) from=0;
		}else if( from>len ){
			from=len;
		}
		if( term<0 ){
			term+=len;
		}else if( term>len ){
			term=len;
		}
		if( term<=from ) return Array();
		return Array( rep->data+from,term-from );
	}

	Array Slice( int from )const{
		return Slice( from,rep->length );
	}
	
	Array Resize( int newlen )const{
		if( newlen<=0 ) return Array();
		int n=rep->length;
		if( newlen<n ) n=newlen;
		Rep *p=Rep::alloc( newlen );
		T *q=p->data;
		q=t_create( n,q,rep->data );
		q=t_create( (newlen-n),q );
		return Array( p );
	}
	
private:
	struct Rep : public gc_object{
		int length;
		T data[0];
		
		Rep():length(0){
			flags=3;
		}
		
		Rep( int length ):length(length){
		}
		
		~Rep(){
			t_destroy( length,data );
		}
		
		void mark(){
			gc_mark_elements( length,data );
		}
		
		static Rep *alloc( int length ){
			if( !length ) return &nullRep;
			void *p=gc_object_alloc( sizeof(Rep)+length*sizeof(T) );
			return ::new(p) Rep( length );
		}
		
	};
	Rep *rep;
	
	static Rep nullRep;
	
	template<class C> friend void gc_mark( Array<C> t );
	template<class C> friend void gc_mark_q( Array<C> t );
	template<class C> friend Array<C> gc_retain( Array<C> t );
	template<class C> friend void gc_assign( Array<C> &lhs,Array<C> rhs );
	template<class C> friend void gc_mark_elements( int n,Array<C> *p );
	
	Array( Rep *rep ):rep(rep){
	}
};

template<class T> typename Array<T>::Rep Array<T>::nullRep;

template<class T> Array<T> *t_create( int n,Array<T> *p ){
	for( int i=0;i<n;++i ) *p++=Array<T>();
	return p;
}

template<class T> Array<T> *t_create( int n,Array<T> *p,const Array<T> *q ){
	for( int i=0;i<n;++i ) *p++=*q++;
	return p;
}

template<class T> void gc_mark( Array<T> t ){
	gc_mark( t.rep );
}

template<class T> void gc_mark_q( Array<T> t ){
	gc_mark_q( t.rep );
}

template<class T> Array<T> gc_retain( Array<T> t ){
#if CFG_CPP_GC_MODE==2
	gc_retain( t.rep );
#endif
	return t;
}

template<class T> void gc_assign( Array<T> &lhs,Array<T> rhs ){
	gc_mark( rhs.rep );
	lhs=rhs;
}

template<class T> void gc_mark_elements( int n,Array<T> *p ){
	for( int i=0;i<n;++i ) gc_mark( p[i].rep );
}
		
// ***** String *****

static const char *_str_load_err;

class String{
public:
	String():rep( &nullRep ){
	}
	
	String( const String &t ):rep( t.rep ){
		rep->retain();
	}

	String( int n ){
		char buf[256];
		sprintf_s( buf,"%i",n );
		rep=Rep::alloc( t_strlen(buf) );
		for( int i=0;i<rep->length;++i ) rep->data[i]=buf[i];
	}
	
	String( Float n ){
		char buf[256];
		
		//would rather use snprintf, but it's doing weird things in MingW.
		//
		sprintf_s( buf,"%.17lg",n );
		//
		char *p;
		for( p=buf;*p;++p ){
			if( *p=='.' || *p=='e' ) break;
		}
		if( !*p ){
			*p++='.';
			*p++='0';
			*p=0;
		}

		rep=Rep::alloc( t_strlen(buf) );
		for( int i=0;i<rep->length;++i ) rep->data[i]=buf[i];
	}

	String( Char ch,int length ):rep( Rep::alloc(length) ){
		for( int i=0;i<length;++i ) rep->data[i]=ch;
	}

	String( const Char *p ):rep( Rep::alloc(t_strlen(p)) ){
		t_memcpy( rep->data,p,rep->length );
	}

	String( const Char *p,int length ):rep( Rep::alloc(length) ){
		t_memcpy( rep->data,p,rep->length );
	}
	
#if __OBJC__	
	String( NSString *nsstr ):rep( Rep::alloc([nsstr length]) ){
		unichar *buf=(unichar*)malloc( rep->length * sizeof(unichar) );
		[nsstr getCharacters:buf range:NSMakeRange(0,rep->length)];
		for( int i=0;i<rep->length;++i ) rep->data[i]=buf[i];
		free( buf );
	}
#endif

#if __cplusplus_winrt
	String( Platform::String ^str ):rep( Rep::alloc(str->Length()) ){
		for( int i=0;i<rep->length;++i ) rep->data[i]=str->Data()[i];
	}
#endif

	~String(){
		rep->release();
	}
	
	template<class C> String( const C *p ):rep( Rep::alloc(t_strlen(p)) ){
		for( int i=0;i<rep->length;++i ) rep->data[i]=p[i];
	}
	
	template<class C> String( const C *p,int length ):rep( Rep::alloc(length) ){
		for( int i=0;i<rep->length;++i ) rep->data[i]=p[i];
	}
	
	int Length()const{
		return rep->length;
	}
	
	const Char *Data()const{
		return rep->data;
	}
	
	Char At( int index )const{
		if( index<0 || index>=rep->length ) dbg_error( "Character index out of range" );
		return rep->data[index]; 
	}
	
	Char operator[]( int index )const{
		return rep->data[index];
	}
	
	String &operator=( const String &t ){
		t.rep->retain();
		rep->release();
		rep=t.rep;
		return *this;
	}
	
	String &operator+=( const String &t ){
		return operator=( *this+t );
	}
	
	int Compare( const String &t )const{
		int n=rep->length<t.rep->length ? rep->length : t.rep->length;
		for( int i=0;i<n;++i ){
			if( int q=(int)(rep->data[i])-(int)(t.rep->data[i]) ) return q;
		}
		return rep->length-t.rep->length;
	}
	
	bool operator==( const String &t )const{
		return rep->length==t.rep->length && t_memcmp( rep->data,t.rep->data,rep->length )==0;
	}
	
	bool operator!=( const String &t )const{
		return rep->length!=t.rep->length || t_memcmp( rep->data,t.rep->data,rep->length )!=0;
	}
	
	bool operator<( const String &t )const{
		return Compare( t )<0;
	}
	
	bool operator<=( const String &t )const{
		return Compare( t )<=0;
	}
	
	bool operator>( const String &t )const{
		return Compare( t )>0;
	}
	
	bool operator>=( const String &t )const{
		return Compare( t )>=0;
	}
	
	String operator+( const String &t )const{
		if( !rep->length ) return t;
		if( !t.rep->length ) return *this;
		Rep *p=Rep::alloc( rep->length+t.rep->length );
		Char *q=p->data;
		q=t_memcpy( q,rep->data,rep->length );
		q=t_memcpy( q,t.rep->data,t.rep->length );
		return String( p );
	}
	
	int Find( String find,int start=0 )const{
		if( start<0 ) start=0;
		while( start+find.rep->length<=rep->length ){
			if( !t_memcmp( rep->data+start,find.rep->data,find.rep->length ) ) return start;
			++start;
		}
		return -1;
	}
	
	int FindLast( String find )const{
		int start=rep->length-find.rep->length;
		while( start>=0 ){
			if( !t_memcmp( rep->data+start,find.rep->data,find.rep->length ) ) return start;
			--start;
		}
		return -1;
	}
	
	int FindLast( String find,int start )const{
		if( start>rep->length-find.rep->length ) start=rep->length-find.rep->length;
		while( start>=0 ){
			if( !t_memcmp( rep->data+start,find.rep->data,find.rep->length ) ) return start;
			--start;
		}
		return -1;
	}
	
	String Trim()const{
		int i=0,i2=rep->length;
		while( i<i2 && rep->data[i]<=32 ) ++i;
		while( i2>i && rep->data[i2-1]<=32 ) --i2;
		if( i==0 && i2==rep->length ) return *this;
		return String( rep->data+i,i2-i );
	}

	Array<String> Split( String sep )const{
	
		if( !sep.rep->length ){
			Array<String> bits( rep->length );
			for( int i=0;i<rep->length;++i ){
				bits[i]=String( (Char)(*this)[i],1 );
			}
			return bits;
		}
		
		int i=0,i2,n=1;
		while( (i2=Find( sep,i ))!=-1 ){
			++n;
			i=i2+sep.rep->length;
		}
		Array<String> bits( n );
		if( n==1 ){
			bits[0]=*this;
			return bits;
		}
		i=0;n=0;
		while( (i2=Find( sep,i ))!=-1 ){
			bits[n++]=Slice( i,i2 );
			i=i2+sep.rep->length;
		}
		bits[n]=Slice( i );
		return bits;
	}

	String Join( Array<String> bits )const{
		if( bits.Length()==0 ) return String();
		if( bits.Length()==1 ) return bits[0];
		int newlen=rep->length * (bits.Length()-1);
		for( int i=0;i<bits.Length();++i ){
			newlen+=bits[i].rep->length;
		}
		Rep *p=Rep::alloc( newlen );
		Char *q=p->data;
		q=t_memcpy( q,bits[0].rep->data,bits[0].rep->length );
		for( int i=1;i<bits.Length();++i ){
			q=t_memcpy( q,rep->data,rep->length );
			q=t_memcpy( q,bits[i].rep->data,bits[i].rep->length );
		}
		return String( p );
	}

	String Replace( String find,String repl )const{
		int i=0,i2,newlen=0;
		while( (i2=Find( find,i ))!=-1 ){
			newlen+=(i2-i)+repl.rep->length;
			i=i2+find.rep->length;
		}
		if( !i ) return *this;
		newlen+=rep->length-i;
		Rep *p=Rep::alloc( newlen );
		Char *q=p->data;
		i=0;
		while( (i2=Find( find,i ))!=-1 ){
			q=t_memcpy( q,rep->data+i,i2-i );
			q=t_memcpy( q,repl.rep->data,repl.rep->length );
			i=i2+find.rep->length;
		}
		q=t_memcpy( q,rep->data+i,rep->length-i );
		return String( p );
	}

	String ToLower()const{
		for( int i=0;i<rep->length;++i ){
			Char t=towlower( rep->data[i] );
			if( t==rep->data[i] ) continue;
			Rep *p=Rep::alloc( rep->length );
			Char *q=p->data;
			t_memcpy( q,rep->data,i );
			for( q[i++]=t;i<rep->length;++i ){
				q[i]=towlower( rep->data[i] );
			}
			return String( p );
		}
		return *this;
	}

	String ToUpper()const{
		for( int i=0;i<rep->length;++i ){
			Char t=towupper( rep->data[i] );
			if( t==rep->data[i] ) continue;
			Rep *p=Rep::alloc( rep->length );
			Char *q=p->data;
			t_memcpy( q,rep->data,i );
			for( q[i++]=t;i<rep->length;++i ){
				q[i]=towupper( rep->data[i] );
			}
			return String( p );
		}
		return *this;
	}
	
	bool Contains( String sub )const{
		return Find( sub )!=-1;
	}

	bool StartsWith( String sub )const{
		return sub.rep->length<=rep->length && !t_memcmp( rep->data,sub.rep->data,sub.rep->length );
	}

	bool EndsWith( String sub )const{
		return sub.rep->length<=rep->length && !t_memcmp( rep->data+rep->length-sub.rep->length,sub.rep->data,sub.rep->length );
	}
	
	String Slice( int from,int term )const{
		int len=rep->length;
		if( from<0 ){
			from+=len;
			if( from<0 ) from=0;
		}else if( from>len ){
			from=len;
		}
		if( term<0 ){
			term+=len;
		}else if( term>len ){
			term=len;
		}
		if( term<from ) return String();
		if( from==0 && term==len ) return *this;
		return String( rep->data+from,term-from );
	}

	String Slice( int from )const{
		return Slice( from,rep->length );
	}
	
	Array<int> ToChars()const{
		Array<int> chars( rep->length );
		for( int i=0;i<rep->length;++i ) chars[i]=rep->data[i];
		return chars;
	}
	
	int ToInt()const{
		char buf[64];
		return atoi( ToCString<char>( buf,sizeof(buf) ) );
	}
	
	Float ToFloat()const{
		char buf[256];
		return atof( ToCString<char>( buf,sizeof(buf) ) );
	}

	template<class C> class CString{
		struct Rep{
			int refs;
			C data[1];
		};
		Rep *_rep;
		static Rep _nul;
	public:
		template<class T> CString( const T *data,int length ){
			_rep=(Rep*)malloc( length*sizeof(C)+sizeof(Rep) );
			_rep->refs=1;
			_rep->data[length]=0;
			for( int i=0;i<length;++i ){
				_rep->data[i]=(C)data[i];
			}
		}
		CString():_rep( new Rep ){
			_rep->refs=1;
		}
		CString( const CString &c ):_rep(c._rep){
			++_rep->refs;
		}
		~CString(){
			if( !--_rep->refs ) free( _rep );
		}
		CString &operator=( const CString &c ){
			++c._rep->refs;
			if( !--_rep->refs ) free( _rep );
			_rep=c._rep;
			return *this;
		}
		operator const C*()const{ 
			return _rep->data;
		}
	};
	
	template<class C> CString<C> ToCString()const{
		return CString<C>( rep->data,rep->length );
	}

	template<class C> C *ToCString( C *p,int length )const{
		if( --length>rep->length ) length=rep->length;
		for( int i=0;i<length;++i ) p[i]=rep->data[i];
		p[length]=0;
		return p;
	}
	
#if __OBJC__	
	NSString *ToNSString()const{
		return [NSString stringWithCharacters:ToCString<unichar>() length:rep->length];
	}
#endif

#if __cplusplus_winrt
	Platform::String ^ToWinRTString()const{
		return ref new Platform::String( rep->data,rep->length );
	}
#endif

	bool Save( FILE *fp ){
		std::vector<unsigned char> buf;
		Save( buf );
		return buf.size() ? fwrite( &buf[0],1,buf.size(),fp )==buf.size() : true;
	}
	
	void Save( std::vector<unsigned char> &buf ){
	
		Char *p=rep->data;
		Char *e=p+rep->length;
		
		while( p<e ){
			Char c=*p++;
			if( c<0x80 ){
				buf.push_back( c );
			}else if( c<0x800 ){
				buf.push_back( 0xc0 | (c>>6) );
				buf.push_back( 0x80 | (c & 0x3f) );
			}else{
				buf.push_back( 0xe0 | (c>>12) );
				buf.push_back( 0x80 | ((c>>6) & 0x3f) );
				buf.push_back( 0x80 | (c & 0x3f) );
			}
		}
	}
	
	static String FromChars( Array<int> chars ){
		int n=chars.Length();
		Rep *p=Rep::alloc( n );
		for( int i=0;i<n;++i ){
			p->data[i]=chars[i];
		}
		return String( p );
	}

	static String Load( FILE *fp ){
		unsigned char tmp[4096];
		std::vector<unsigned char> buf;
		for(;;){
			int n=fread( tmp,1,4096,fp );
			if( n>0 ) buf.insert( buf.end(),tmp,tmp+n );
			if( n!=4096 ) break;
		}
		return buf.size() ? String::Load( &buf[0],buf.size() ) : String();
	}
	
	static String Load( unsigned char *p,int n ){
	
		_str_load_err=0;
		
		unsigned char *e=p+n;
		std::vector<Char> chars;
		
		int t0=n>0 ? p[0] : -1;
		int t1=n>1 ? p[1] : -1;

		if( t0==0xfe && t1==0xff ){
			p+=2;
			while( p<e-1 ){
				int c=*p++;
				chars.push_back( (c<<8)|*p++ );
			}
		}else if( t0==0xff && t1==0xfe ){
			p+=2;
			while( p<e-1 ){
				int c=*p++;
				chars.push_back( (*p++<<8)|c );
			}
		}else{
			int t2=n>2 ? p[2] : -1;
			if( t0==0xef && t1==0xbb && t2==0xbf ) p+=3;
			unsigned char *q=p;
			bool fail=false;
			while( p<e ){
				unsigned int c=*p++;
				if( c & 0x80 ){
					if( (c & 0xe0)==0xc0 ){
						if( p>=e || (p[0] & 0xc0)!=0x80 ){
							fail=true;
							break;
						}
						c=((c & 0x1f)<<6) | (p[0] & 0x3f);
						p+=1;
					}else if( (c & 0xf0)==0xe0 ){
						if( p+1>=e || (p[0] & 0xc0)!=0x80 || (p[1] & 0xc0)!=0x80 ){
							fail=true;
							break;
						}
						c=((c & 0x0f)<<12) | ((p[0] & 0x3f)<<6) | (p[1] & 0x3f);
						p+=2;
					}else{
						fail=true;
						break;
					}
				}
				chars.push_back( c );
			}
			if( fail ){
				_str_load_err="Invalid UTF-8";
				return String( q,n );
			}
		}
		return chars.size() ? String( &chars[0],chars.size() ) : String();
	}

private:
	
	struct Rep{
		int refs;
		int length;
		Char data[0];
		
		Rep():refs(1),length(0){
		}
		
		Rep( int length ):refs(1),length(length){
		}
		
		void retain(){
			++refs;
		}
		
		void release(){
			if( --refs || !length ) return;
			free( this );
		}

		static Rep *alloc( int length ){
			if( !length ) return &nullRep;
			void *p=malloc( sizeof(Rep)+length*sizeof(Char) );
			return new(p) Rep( length );
		}
	};
	Rep *rep;
	
	static Rep nullRep;
	
	String( Rep *rep ):rep(rep){
	}
};

String::Rep String::nullRep;

String *t_create( int n,String *p ){
	for( int i=0;i<n;++i ) new( &p[i] ) String();
	return p+n;
}

String *t_create( int n,String *p,const String *q ){
	for( int i=0;i<n;++i ) new( &p[i] ) String( q[i] );
	return p+n;
}

void t_destroy( int n,String *p ){
	for( int i=0;i<n;++i ) p[i].~String();
}

// ***** Object *****

String dbg_stacktrace();

class Object : public gc_object{
public:
	virtual bool Equals( Object *obj ){
		return this==obj;
	}
	
	virtual int Compare( Object *obj ){
		return (char*)this-(char*)obj;
	}
	
	virtual String debug(){
		return "+Object\n";
	}
};

class ThrowableObject : public Object{
#ifndef NDEBUG
public:
	String stackTrace;
	ThrowableObject():stackTrace( dbg_stacktrace() ){}
#endif
};

struct gc_interface{
	virtual ~gc_interface(){}
};

//***** Debugger *****

//#define Error bbError
//#define Print bbPrint

int bbPrint( String t );

#define dbg_stream stderr

#if _MSC_VER
#define dbg_typeof decltype
#else
#define dbg_typeof __typeof__
#endif 

struct dbg_func;
struct dbg_var_type;

static int dbg_suspend;
static int dbg_stepmode;

const char *dbg_info;
String dbg_exstack;

static void *dbg_var_buf[65536*3];
static void **dbg_var_ptr=dbg_var_buf;

static dbg_func *dbg_func_buf[1024];
static dbg_func **dbg_func_ptr=dbg_func_buf;

String dbg_type( bool *p ){
	return "Bool";
}

String dbg_type( int *p ){
	return "Int";
}

String dbg_type( Float *p ){
	return "Float";
}

String dbg_type( String *p ){
	return "String";
}

template<class T> String dbg_type( T *p ){
	return "Object";
}

template<class T> String dbg_type( Array<T> *p ){
	return dbg_type( &(*p)[0] )+"[]";
}

String dbg_value( bool *p ){
	return *p ? "True" : "False";
}

String dbg_value( int *p ){
	return String( *p );
}

String dbg_value( Float *p ){
	return String( *p );
}

String dbg_value( String *p ){
	String t=*p;
	if( t.Length()>100 ) t=t.Slice( 0,100 )+"...";
	t=t.Replace( "\"","~q" );
	t=t.Replace( "\t","~t" );
	t=t.Replace( "\n","~n" );
	t=t.Replace( "\r","~r" );
	return String("\"")+t+"\"";
}

template<class T> String dbg_value( T *t ){
	Object *p=dynamic_cast<Object*>( *t );
	char buf[64];
	sprintf_s( buf,"%p",p );
	return String("@") + (buf[0]=='0' && buf[1]=='x' ? buf+2 : buf );
}

template<class T> String dbg_value( Array<T> *p ){
	String t="[";
	int n=(*p).Length();
	for( int i=0;i<n;++i ){
		if( i ) t+=",";
		t+=dbg_value( &(*p)[i] );
	}
	return t+"]";
}

template<class T> String dbg_decl( const char *id,T *ptr ){
	return String( id )+":"+dbg_type(ptr)+"="+dbg_value(ptr)+"\n";
}

struct dbg_var_type{
	virtual String type( void *p )=0;
	virtual String value( void *p )=0;
};

template<class T> struct dbg_var_type_t : public dbg_var_type{

	String type( void *p ){
		return dbg_type( (T*)p );
	}
	
	String value( void *p ){
		return dbg_value( (T*)p );
	}
	
	static dbg_var_type_t<T> info;
};
template<class T> dbg_var_type_t<T> dbg_var_type_t<T>::info;

struct dbg_blk{
	void **var_ptr;
	
	dbg_blk():var_ptr(dbg_var_ptr){
		if( dbg_stepmode=='l' ) --dbg_suspend;
	}
	
	~dbg_blk(){
		if( dbg_stepmode=='l' ) ++dbg_suspend;
		dbg_var_ptr=var_ptr;
	}
};

struct dbg_func : public dbg_blk{
	const char *id;
	const char *info;

	dbg_func( const char *p ):id(p),info(dbg_info){
		*dbg_func_ptr++=this;
		if( dbg_stepmode=='s' ) --dbg_suspend;
	}
	
	~dbg_func(){
		if( dbg_stepmode=='s' ) ++dbg_suspend;
		--dbg_func_ptr;
		dbg_info=info;
	}
};

int dbg_print( String t ){
	static char *buf;
	static int len;
	int n=t.Length();
	if( n+100>len ){
		len=n+100;
		free( buf );
		buf=(char*)malloc( len );
	}
	buf[n]='\n';
	for( int i=0;i<n;++i ) buf[i]=t[i];
	fwrite( buf,n+1,1,dbg_stream );
	fflush( dbg_stream );
	return 0;
}

void dbg_callstack(){

	void **var_ptr=dbg_var_buf;
	dbg_func **func_ptr=dbg_func_buf;
	
	while( var_ptr!=dbg_var_ptr ){
		while( func_ptr!=dbg_func_ptr && var_ptr==(*func_ptr)->var_ptr ){
			const char *id=(*func_ptr++)->id;
			const char *info=func_ptr!=dbg_func_ptr ? (*func_ptr)->info : dbg_info;
			fprintf( dbg_stream,"+%s;%s\n",id,info );
		}
		void *vp=*var_ptr++;
		const char *nm=(const char*)*var_ptr++;
		dbg_var_type *ty=(dbg_var_type*)*var_ptr++;
		dbg_print( String(nm)+":"+ty->type(vp)+"="+ty->value(vp) );
	}
	while( func_ptr!=dbg_func_ptr ){
		const char *id=(*func_ptr++)->id;
		const char *info=func_ptr!=dbg_func_ptr ? (*func_ptr)->info : dbg_info;
		fprintf( dbg_stream,"+%s;%s\n",id,info );
	}
}

String dbg_stacktrace(){
	if( !dbg_info || !dbg_info[0] ) return "";
	String str=String( dbg_info )+"\n";
	dbg_func **func_ptr=dbg_func_ptr;
	if( func_ptr==dbg_func_buf ) return str;
	while( --func_ptr!=dbg_func_buf ){
		str+=String( (*func_ptr)->info )+"\n";
	}
	return str;
}

void dbg_throw( const char *err ){
	dbg_exstack=dbg_stacktrace();
	throw err;
}

void dbg_stop(){

#if TARGET_OS_IPHONE
	dbg_throw( "STOP" );
#endif

	fprintf( dbg_stream,"{{~~%s~~}}\n",dbg_info );
	dbg_callstack();
	dbg_print( "" );
	
	for(;;){

		char buf[256];
		char *e=fgets( buf,256,stdin );
		if( !e ) exit( -1 );
		
		e=strchr( buf,'\n' );
		if( !e ) exit( -1 );
		
		*e=0;
		
		Object *p;
		
		switch( buf[0] ){
		case '?':
			break;
		case 'r':	//run
			dbg_suspend=0;		
			dbg_stepmode=0;
			return;
		case 's':	//step
			dbg_suspend=1;
			dbg_stepmode='s';
			return;
		case 'e':	//enter func
			dbg_suspend=1;
			dbg_stepmode='e';
			return;
		case 'l':	//leave block
			dbg_suspend=0;
			dbg_stepmode='l';
			return;
		case '@':	//dump object
			p=0;
			sscanf_s( buf+1,"%p",&p );
			if( p ){
				dbg_print( p->debug() );
			}else{
				dbg_print( "" );
			}
			break;
		case 'q':	//quit!
			exit( 0 );
			break;			
		default:
			printf( "????? %s ?????",buf );fflush( stdout );
			exit( -1 );
		}
	}
}

void dbg_error( const char *err ){

#if TARGET_OS_IPHONE
	dbg_throw( err );
#endif

	for(;;){
		bbPrint( String("Monkey Runtime Error : ")+err );
		bbPrint( dbg_stacktrace() );
		dbg_stop();
	}
}

#define DBG_INFO(X) dbg_info=(X);if( dbg_suspend>0 ) dbg_stop();

#define DBG_ENTER(P) dbg_func _dbg_func(P);

#define DBG_BLOCK() dbg_blk _dbg_blk;

#define DBG_GLOBAL( ID,NAME )	//TODO!

#define DBG_LOCAL( ID,NAME )\
*dbg_var_ptr++=&ID;\
*dbg_var_ptr++=(void*)NAME;\
*dbg_var_ptr++=&dbg_var_type_t<dbg_typeof(ID)>::info;

//**** main ****

int argc;
const char **argv;

Float D2R=0.017453292519943295f;
Float R2D=57.29577951308232f;

int bbPrint( String t ){

	static std::vector<unsigned char> buf;
	buf.clear();
	t.Save( buf );
	buf.push_back( '\n' );
	buf.push_back( 0 );
	
#if __cplusplus_winrt	//winrt?

#if CFG_WINRT_PRINT_ENABLED
	OutputDebugStringA( (const char*)&buf[0] );
#endif

#elif _WIN32			//windows?

	fputs( (const char*)&buf[0],stdout );
	fflush( stdout );

#elif __APPLE__			//macos/ios?

	fputs( (const char*)&buf[0],stdout );
	fflush( stdout );
	
#elif __linux			//linux?

#if CFG_ANDROID_NDK_PRINT_ENABLED
	LOGI( (const char*)&buf[0] );
#else
	fputs( (const char*)&buf[0],stdout );
	fflush( stdout );
#endif

#endif

	return 0;
}

class BBExitApp{
};

int bbError( String err ){
	if( !err.Length() ){
#if __cplusplus_winrt
		throw BBExitApp();
#else
		exit( 0 );
#endif
	}
	dbg_error( err.ToCString<char>() );
	return 0;
}

int bbDebugLog( String t ){
	bbPrint( t );
	return 0;
}

int bbDebugStop(){
	dbg_stop();
	return 0;
}

int bbInit();
int bbMain();

#if _MSC_VER

static void _cdecl seTranslator( unsigned int ex,EXCEPTION_POINTERS *p ){

	switch( ex ){
	case EXCEPTION_ACCESS_VIOLATION:dbg_error( "Memory access violation" );
	case EXCEPTION_ILLEGAL_INSTRUCTION:dbg_error( "Illegal instruction" );
	case EXCEPTION_INT_DIVIDE_BY_ZERO:dbg_error( "Integer divide by zero" );
	case EXCEPTION_STACK_OVERFLOW:dbg_error( "Stack overflow" );
	}
	dbg_error( "Unknown exception" );
}

#else

void sighandler( int sig  ){
	switch( sig ){
	case SIGSEGV:dbg_error( "Memory access violation" );
	case SIGILL:dbg_error( "Illegal instruction" );
	case SIGFPE:dbg_error( "Floating point exception" );
#if !_WIN32
	case SIGBUS:dbg_error( "Bus error" );
#endif	
	}
	dbg_error( "Unknown signal" );
}

#endif

//entry point call by target main()...
//
int bb_std_main( int argc,const char **argv ){

	::argc=argc;
	::argv=argv;
	
#if _MSC_VER

	_set_se_translator( seTranslator );

#else
	
	signal( SIGSEGV,sighandler );
	signal( SIGILL,sighandler );
	signal( SIGFPE,sighandler );
#if !_WIN32
	signal( SIGBUS,sighandler );
#endif

#endif

	if( !setlocale( LC_CTYPE,"en_US.UTF-8" ) ){
		setlocale( LC_CTYPE,"" );
	}

	gc_init1();

	bbInit();
	
	gc_init2();

	bbMain();

	return 0;
}


//***** game.h *****

struct BBGameEvent{
	enum{
		None=0,
		KeyDown=1,KeyUp=2,KeyChar=3,
		MouseDown=4,MouseUp=5,MouseMove=6,
		TouchDown=7,TouchUp=8,TouchMove=9,
		MotionAccel=10
	};
};

class BBGameDelegate : public Object{
public:
	virtual void StartGame(){}
	virtual void SuspendGame(){}
	virtual void ResumeGame(){}
	virtual void UpdateGame(){}
	virtual void RenderGame(){}
	virtual void KeyEvent( int event,int data ){}
	virtual void MouseEvent( int event,int data,float x,float y ){}
	virtual void TouchEvent( int event,int data,float x,float y ){}
	virtual void MotionEvent( int event,int data,float x,float y,float z ){}
	virtual void DiscardGraphics(){}
};

struct BBDisplayMode : public Object{
	int width;
	int height;
	int format;
	int hertz;
	int flags;
	BBDisplayMode( int width=0,int height=0,int format=0,int hertz=0,int flags=0 ):width(width),height(height),format(format),hertz(hertz),flags(flags){}
};

class BBGame{
public:
	BBGame();
	virtual ~BBGame(){}
	
	// ***** Extern *****
	static BBGame *Game(){ return _game; }
	
	virtual void SetDelegate( BBGameDelegate *delegate );
	virtual BBGameDelegate *Delegate(){ return _delegate; }
	
	virtual void SetKeyboardEnabled( bool enabled );
	virtual bool KeyboardEnabled();
	
	virtual void SetUpdateRate( int updateRate );
	virtual int UpdateRate();
	
	virtual bool Started(){ return _started; }
	virtual bool Suspended(){ return _suspended; }
	
	virtual int Millisecs();
	virtual void GetDate( Array<int> date );
	virtual int SaveState( String state );
	virtual String LoadState();
	virtual String LoadString( String path );
	virtual bool PollJoystick( int port,Array<Float> joyx,Array<Float> joyy,Array<Float> joyz,Array<bool> buttons );
	virtual void OpenUrl( String url );
	virtual void SetMouseVisible( bool visible );
	
	virtual int GetDeviceWidth(){ return 0; }
	virtual int GetDeviceHeight(){ return 0; }
	virtual void SetDeviceWindow( int width,int height,int flags ){}
	virtual Array<BBDisplayMode*> GetDisplayModes(){ return Array<BBDisplayMode*>(); }
	virtual BBDisplayMode *GetDesktopMode(){ return 0; }
	virtual void SetSwapInterval( int interval ){}

	// ***** Native *****	
	virtual String PathToFilePath( String path );
	virtual FILE *OpenFile( String path,String mode );
	virtual unsigned char *LoadData( String path,int *plength );
	virtual unsigned char *LoadImageData( String path,int *width,int *height,int *depth ){ return 0; }
	virtual unsigned char *LoadAudioData( String path,int *length,int *channels,int *format,int *hertz ){ return 0; }
	
	//***** Internal *****
	virtual void Die( ThrowableObject *ex );
	virtual void gc_collect();
	virtual void StartGame();
	virtual void SuspendGame();
	virtual void ResumeGame();
	virtual void UpdateGame();
	virtual void RenderGame();
	virtual void KeyEvent( int ev,int data );
	virtual void MouseEvent( int ev,int data,float x,float y );
	virtual void TouchEvent( int ev,int data,float x,float y );
	virtual void MotionEvent( int ev,int data,float x,float y,float z );
	virtual void DiscardGraphics();
	
protected:

	static BBGame *_game;

	BBGameDelegate *_delegate;
	bool _keyboardEnabled;
	int _updateRate;
	bool _started;
	bool _suspended;
};

//***** game.cpp *****

BBGame *BBGame::_game;

BBGame::BBGame():
_delegate( 0 ),
_keyboardEnabled( false ),
_updateRate( 0 ),
_started( false ),
_suspended( false ){
	_game=this;
}

void BBGame::SetDelegate( BBGameDelegate *delegate ){
	_delegate=delegate;
}

void BBGame::SetKeyboardEnabled( bool enabled ){
	_keyboardEnabled=enabled;
}

bool BBGame::KeyboardEnabled(){
	return _keyboardEnabled;
}

void BBGame::SetUpdateRate( int updateRate ){
	_updateRate=updateRate;
}

int BBGame::UpdateRate(){
	return _updateRate;
}

int BBGame::Millisecs(){
	return 0;
}

void BBGame::GetDate( Array<int> date ){
	int n=date.Length();
	if( n>0 ){
		time_t t=time( 0 );
		
#if _MSC_VER
		struct tm tii;
		struct tm *ti=&tii;
		localtime_s( ti,&t );
#else
		struct tm *ti=localtime( &t );
#endif

		date[0]=ti->tm_year+1900;
		if( n>1 ){ 
			date[1]=ti->tm_mon+1;
			if( n>2 ){
				date[2]=ti->tm_mday;
				if( n>3 ){
					date[3]=ti->tm_hour;
					if( n>4 ){
						date[4]=ti->tm_min;
						if( n>5 ){
							date[5]=ti->tm_sec;
							if( n>6 ){
								date[6]=0;
							}
						}
					}
				}
			}
		}
	}
}

int BBGame::SaveState( String state ){
	if( FILE *f=OpenFile( "./.monkeystate","wb" ) ){
		bool ok=state.Save( f );
		fclose( f );
		return ok ? 0 : -2;
	}
	return -1;
}

String BBGame::LoadState(){
	if( FILE *f=OpenFile( "./.monkeystate","rb" ) ){
		String str=String::Load( f );
		fclose( f );
		return str;
	}
	return "";
}

String BBGame::LoadString( String path ){
	if( FILE *fp=OpenFile( path,"rb" ) ){
		String str=String::Load( fp );
		fclose( fp );
		return str;
	}
	return "";
}

bool BBGame::PollJoystick( int port,Array<Float> joyx,Array<Float> joyy,Array<Float> joyz,Array<bool> buttons ){
	return false;
}

void BBGame::OpenUrl( String url ){
}

void BBGame::SetMouseVisible( bool visible ){
}

//***** C++ Game *****

String BBGame::PathToFilePath( String path ){
	return path;
}

FILE *BBGame::OpenFile( String path,String mode ){
	path=PathToFilePath( path );
	if( path=="" ) return 0;
	
#if __cplusplus_winrt
	path=path.Replace( "/","\\" );
	FILE *f;
	if( _wfopen_s( &f,path.ToCString<wchar_t>(),mode.ToCString<wchar_t>() ) ) return 0;
	return f;
#elif _WIN32
	return _wfopen( path.ToCString<wchar_t>(),mode.ToCString<wchar_t>() );
#else
	return fopen( path.ToCString<char>(),mode.ToCString<char>() );
#endif
}

unsigned char *BBGame::LoadData( String path,int *plength ){

	FILE *f=OpenFile( path,"rb" );
	if( !f ) return 0;

	const int BUF_SZ=4096;
	std::vector<void*> tmps;
	int length=0;
	
	for(;;){
		void *p=malloc( BUF_SZ );
		int n=fread( p,1,BUF_SZ,f );
		tmps.push_back( p );
		length+=n;
		if( n!=BUF_SZ ) break;
	}
	fclose( f );
	
	unsigned char *data=(unsigned char*)malloc( length );
	unsigned char *p=data;
	
	int sz=length;
	for( int i=0;i<tmps.size();++i ){
		int n=sz>BUF_SZ ? BUF_SZ : sz;
		memcpy( p,tmps[i],n );
		free( tmps[i] );
		sz-=n;
		p+=n;
	}
	
	*plength=length;
	
	gc_ext_malloced( length );
	
	return data;
}

//***** INTERNAL *****

void BBGame::Die( ThrowableObject *ex ){
	bbPrint( "Monkey Runtime Error : Uncaught Monkey Exception" );
#ifndef NDEBUG
	bbPrint( ex->stackTrace );
#endif
	exit( -1 );
}

void BBGame::gc_collect(){
	gc_mark( _delegate );
	::gc_collect();
}

void BBGame::StartGame(){

	if( _started ) return;
	_started=true;
	
	try{
		_delegate->StartGame();
	}catch( ThrowableObject *ex ){
		Die( ex );
	}
	gc_collect();
}

void BBGame::SuspendGame(){

	if( !_started || _suspended ) return;
	_suspended=true;
	
	try{
		_delegate->SuspendGame();
	}catch( ThrowableObject *ex ){
		Die( ex );
	}
	gc_collect();
}

void BBGame::ResumeGame(){

	if( !_started || !_suspended ) return;
	_suspended=false;
	
	try{
		_delegate->ResumeGame();
	}catch( ThrowableObject *ex ){
		Die( ex );
	}
	gc_collect();
}

void BBGame::UpdateGame(){

	if( !_started || _suspended ) return;
	
	try{
		_delegate->UpdateGame();
	}catch( ThrowableObject *ex ){
		Die( ex );
	}
	gc_collect();
}

void BBGame::RenderGame(){

	if( !_started ) return;
	
	try{
		_delegate->RenderGame();
	}catch( ThrowableObject *ex ){
		Die( ex );
	}
	gc_collect();
}

void BBGame::KeyEvent( int ev,int data ){

	if( !_started ) return;
	
	try{
		_delegate->KeyEvent( ev,data );
	}catch( ThrowableObject *ex ){
		Die( ex );
	}
	gc_collect();
}

void BBGame::MouseEvent( int ev,int data,float x,float y ){

	if( !_started ) return;
	
	try{
		_delegate->MouseEvent( ev,data,x,y );
	}catch( ThrowableObject *ex ){
		Die( ex );
	}
	gc_collect();
}

void BBGame::TouchEvent( int ev,int data,float x,float y ){

	if( !_started ) return;
	
	try{
		_delegate->TouchEvent( ev,data,x,y );
	}catch( ThrowableObject *ex ){
		Die( ex );
	}
	gc_collect();
}

void BBGame::MotionEvent( int ev,int data,float x,float y,float z ){

	if( !_started ) return;
	
	try{
		_delegate->MotionEvent( ev,data,x,y,z );
	}catch( ThrowableObject *ex ){
		Die( ex );
	}
	gc_collect();
}

void BBGame::DiscardGraphics(){

	if( !_started ) return;
	
	try{
		_delegate->DiscardGraphics();
	}catch( ThrowableObject *ex ){
		Die( ex );
	}
	gc_collect();
}


//***** wavloader.h *****
//
unsigned char *LoadWAV( FILE *f,int *length,int *channels,int *format,int *hertz );

//***** wavloader.cpp *****
//
static const char *readTag( FILE *f ){
	static char buf[8];
	if( fread( buf,4,1,f )!=1 ) return "";
	buf[4]=0;
	return buf;
}

static int readInt( FILE *f ){
	unsigned char buf[4];
	if( fread( buf,4,1,f )!=1 ) return -1;
	return (buf[3]<<24) | (buf[2]<<16) | (buf[1]<<8) | buf[0];
}

static int readShort( FILE *f ){
	unsigned char buf[2];
	if( fread( buf,2,1,f )!=1 ) return -1;
	return (buf[1]<<8) | buf[0];
}

static void skipBytes( int n,FILE *f ){
	char *p=(char*)malloc( n );
	fread( p,n,1,f );
	free( p );
}

unsigned char *LoadWAV( FILE *f,int *plength,int *pchannels,int *pformat,int *phertz ){
	if( !strcmp( readTag( f ),"RIFF" ) ){
		int len=readInt( f )-8;len=len;
		if( !strcmp( readTag( f ),"WAVE" ) ){
			if( !strcmp( readTag( f ),"fmt " ) ){
				int len2=readInt( f );
				int comp=readShort( f );
				if( comp==1 ){
					int chans=readShort( f );
					int hertz=readInt( f );
					int bytespersec=readInt( f );bytespersec=bytespersec;
					int pad=readShort( f );pad=pad;
					int bits=readShort( f );
					int format=bits/8;
					if( len2>16 ) skipBytes( len2-16,f );
					for(;;){
						const char *p=readTag( f );
						if( feof( f ) ) break;
						int size=readInt( f );
						if( strcmp( p,"data" ) ){
							skipBytes( size,f );
							continue;
						}
						unsigned char *data=(unsigned char*)malloc( size );
						if( fread( data,size,1,f )==1 ){
							*plength=size/(chans*format);
							*pchannels=chans;
							*pformat=format;
							*phertz=hertz;
							return data;
						}
						free( data );
					}
				}
			}
		}
	}
	return 0;
}



//***** oggloader.h *****
unsigned char *LoadOGG( FILE *f,int *length,int *channels,int *format,int *hertz );

//***** oggloader.cpp *****
unsigned char *LoadOGG( FILE *f,int *length,int *channels,int *format,int *hertz ){

	int error;
	stb_vorbis *v=stb_vorbis_open_file( f,0,&error,0 );
	if( !v ) return 0;
	
	stb_vorbis_info info=stb_vorbis_get_info( v );
	
	int limit=info.channels*4096;
	int offset=0,total=limit;

	short *data=(short*)malloc( total*2 );
	
	for(;;){
		int n=stb_vorbis_get_frame_short_interleaved( v,info.channels,data+offset,total-offset );
		if( !n ) break;
	
		offset+=n*info.channels;
		
		if( offset+limit>total ){
			total*=2;
			data=(short*)realloc( data,total*2 );
		}
	}
	
	data=(short*)realloc( data,offset*2 );
	
	*length=offset/info.channels;
	*channels=info.channels;
	*format=2;
	*hertz=info.sample_rate;
	
	stb_vorbis_close(v);
	
	return (unsigned char*)data;
}



//***** glfwgame.h *****

struct BBGlfwVideoMode : public Object{
	int Width;
	int Height;
	int RedBits;
	int GreenBits;
	int BlueBits;
	BBGlfwVideoMode( int w,int h,int r,int g,int b ):Width(w),Height(h),RedBits(r),GreenBits(g),BlueBits(b){}
};

class BBGlfwGame : public BBGame{
public:
	BBGlfwGame();

	static BBGlfwGame *GlfwGame(){ return _glfwGame; }
	
	virtual void SetUpdateRate( int hertz );
	virtual int Millisecs();
	virtual bool PollJoystick( int port,Array<Float> joyx,Array<Float> joyy,Array<Float> joyz,Array<bool> buttons );
	virtual void OpenUrl( String url );
	virtual void SetMouseVisible( bool visible );
	
	virtual int GetDeviceWidth();
	virtual int GetDeviceHeight();
	virtual void SetDeviceWindow( int width,int height,int flags );
	virtual Array<BBDisplayMode*> GetDisplayModes();
	virtual BBDisplayMode *GetDesktopMode();
	virtual void SetSwapInterval( int interval );

	virtual String PathToFilePath( String path );
	virtual unsigned char *LoadImageData( String path,int *width,int *height,int *depth );
	virtual unsigned char *LoadAudioData( String path,int *length,int *channels,int *format,int *hertz );
	
	virtual void SetGlfwWindow( int width,int height,int red,int green,int blue,int alpha,int depth,int stencil,bool fullscreen );
	virtual BBGlfwVideoMode *GetGlfwDesktopMode();
	virtual Array<BBGlfwVideoMode*> GetGlfwVideoModes();
	
	virtual void Run();
	
private:
	static BBGlfwGame *_glfwGame;

	double _updatePeriod;
	double _nextUpdate;
	
	int _swapInterval;
	
	void UpdateEvents();
		
protected:
	static int TransKey( int key );
	static int KeyToChar( int key );
	
	static void GLFWCALL OnKey( int key,int action );
	static void GLFWCALL OnChar( int chr,int action );
	static void GLFWCALL OnMouseButton( int button,int action );
	static void GLFWCALL OnMousePos( int x,int y );
	static int  GLFWCALL OnWindowClose();
};

//***** glfwgame.cpp *****

#define _QUOTE(X) #X
#define _STRINGIZE( X ) _QUOTE(X)

enum{
	VKEY_BACKSPACE=8,VKEY_TAB,
	VKEY_ENTER=13,
	VKEY_SHIFT=16,
	VKEY_CONTROL=17,
	VKEY_ESC=27,
	VKEY_SPACE=32,
	VKEY_PAGEUP=33,VKEY_PAGEDOWN,VKEY_END,VKEY_HOME,
	VKEY_LEFT=37,VKEY_UP,VKEY_RIGHT,VKEY_DOWN,
	VKEY_INSERT=45,VKEY_DELETE,
	VKEY_0=48,VKEY_1,VKEY_2,VKEY_3,VKEY_4,VKEY_5,VKEY_6,VKEY_7,VKEY_8,VKEY_9,
	VKEY_A=65,VKEY_B,VKEY_C,VKEY_D,VKEY_E,VKEY_F,VKEY_G,VKEY_H,VKEY_I,VKEY_J,
	VKEY_K,VKEY_L,VKEY_M,VKEY_N,VKEY_O,VKEY_P,VKEY_Q,VKEY_R,VKEY_S,VKEY_T,
	VKEY_U,VKEY_V,VKEY_W,VKEY_X,VKEY_Y,VKEY_Z,
	
	VKEY_LSYS=91,VKEY_RSYS,
	
	VKEY_NUM0=96,VKEY_NUM1,VKEY_NUM2,VKEY_NUM3,VKEY_NUM4,
	VKEY_NUM5,VKEY_NUM6,VKEY_NUM7,VKEY_NUM8,VKEY_NUM9,
	VKEY_NUMMULTIPLY=106,VKEY_NUMADD,VKEY_NUMSLASH,
	VKEY_NUMSUBTRACT,VKEY_NUMDECIMAL,VKEY_NUMDIVIDE,

	VKEY_F1=112,VKEY_F2,VKEY_F3,VKEY_F4,VKEY_F5,VKEY_F6,
	VKEY_F7,VKEY_F8,VKEY_F9,VKEY_F10,VKEY_F11,VKEY_F12,

	VKEY_LSHIFT=160,VKEY_RSHIFT,
	VKEY_LCONTROL=162,VKEY_RCONTROL,
	VKEY_LALT=164,VKEY_RALT,

	VKEY_TILDE=192,VKEY_MINUS=189,VKEY_EQUALS=187,
	VKEY_OPENBRACKET=219,VKEY_BACKSLASH=220,VKEY_CLOSEBRACKET=221,
	VKEY_SEMICOLON=186,VKEY_QUOTES=222,
	VKEY_COMMA=188,VKEY_PERIOD=190,VKEY_SLASH=191
};

BBGlfwGame *BBGlfwGame::_glfwGame;

BBGlfwGame::BBGlfwGame():_updatePeriod(0),_nextUpdate(0),_swapInterval( CFG_GLFW_SWAP_INTERVAL ){
	_glfwGame=this;
}

//***** BBGame *****

void Init_GL_Exts();

int glfwGraphicsSeq=0;

void BBGlfwGame::SetUpdateRate( int updateRate ){
	BBGame::SetUpdateRate( updateRate );
	if( _updateRate ) _updatePeriod=1.0/_updateRate;
	_nextUpdate=0;
}

int BBGlfwGame::Millisecs(){
	return int( glfwGetTime()*1000.0 );
}

bool BBGlfwGame::PollJoystick( int port,Array<Float> joyx,Array<Float> joyy,Array<Float> joyz,Array<bool> buttons ){

	int joy=GLFW_JOYSTICK_1+port;
	if( !glfwGetJoystickParam( joy,GLFW_PRESENT ) ) return false;

	//read axes
	float axes[6];
	memset( axes,0,sizeof(axes) );
	int n_axes=glfwGetJoystickPos( joy,axes,6 );
	joyx[0]=axes[0];joyy[0]=axes[1];joyz[0]=axes[2];
	joyx[1]=axes[3];joyy[1]=axes[4];joyz[1]=axes[5];
	
	//read buttons
	unsigned char buts[32];
	memset( buts,0,sizeof(buts) );
	int n_buts=glfwGetJoystickButtons( joy,buts,32 );
	if( n_buts>12 ){
		for( int i=0;i<8;++i ) buttons[i]=(buts[i]==GLFW_PRESS);
		for( int i=0;i<4;++i ) buttons[i+8]=(buts[n_buts-4+i]==GLFW_PRESS);
		for( int i=0;i<n_buts-12;++i ) buttons[i+12]=(buts[i+8]==GLFW_PRESS);
	}else{
		for( int i=0;i<n_buts;++i ) buttons[i]=(buts[i]=-GLFW_PRESS);
	}
	
	//kludges for device type!
	if( n_axes==5 && n_buts==14 ){
		//XBOX_360?
		joyx[1]=axes[4];
		joyy[1]=-axes[3];
	}else if( n_axes==4 && n_buts==18 ){
		//My Saitek?
		joyy[1]=-joyz[0];
	}
	
	//enough!
	return true;
}

void BBGlfwGame::OpenUrl( String url ){
#if _WIN32
	ShellExecute( HWND_DESKTOP,"open",url.ToCString<char>(),0,0,SW_SHOWNORMAL );
#elif __APPLE__
	if( CFURLRef cfurl=CFURLCreateWithBytes( 0,url.ToCString<UInt8>(),url.Length(),kCFStringEncodingASCII,0 ) ){
		LSOpenCFURLRef( cfurl,0 );
		CFRelease( cfurl );
	}
#elif __linux
	system( ( String( "xdg-open \"" )+url+"\"" ).ToCString<char>() );
#endif
}

void BBGlfwGame::SetMouseVisible( bool visible ){
	if( visible ){
		glfwEnable( GLFW_MOUSE_CURSOR );
	}else{
		glfwDisable( GLFW_MOUSE_CURSOR );
	}
}

String BBGlfwGame::PathToFilePath( String path ){
	if( !path.StartsWith( "monkey:" ) ){
		return path;
	}else if( path.StartsWith( "monkey://data/" ) ){
		return String("./data/")+path.Slice(14);
	}else if( path.StartsWith( "monkey://internal/" ) ){
		return String("./internal/")+path.Slice(18);
	}else if( path.StartsWith( "monkey://external/" ) ){
		return String("./external/")+path.Slice(18);
	}
	return "";
}

unsigned char *BBGlfwGame::LoadImageData( String path,int *width,int *height,int *depth ){

	FILE *f=OpenFile( path,"rb" );
	if( !f ) return 0;
	
	unsigned char *data=stbi_load_from_file( f,width,height,depth,0 );
	fclose( f );
	
	if( data ) gc_ext_malloced( (*width)*(*height)*(*depth) );
	
	return data;
}

unsigned char *BBGlfwGame::LoadAudioData( String path,int *length,int *channels,int *format,int *hertz ){

	FILE *f=OpenFile( path,"rb" );
	if( !f ) return 0;
	
	unsigned char *data=0;
	
	if( path.ToLower().EndsWith( ".wav" ) ){
		data=LoadWAV( f,length,channels,format,hertz );
	}else if( path.ToLower().EndsWith( ".ogg" ) ){
		data=LoadOGG( f,length,channels,format,hertz );
	}
	fclose( f );
	
	if( data ) gc_ext_malloced( (*length)*(*channels)*(*format) );
	
	return data;
}

//glfw key to monkey key!
int BBGlfwGame::TransKey( int key ){

	if( key>='0' && key<='9' ) return key;
	if( key>='A' && key<='Z' ) return key;

	switch( key ){

	case ' ':return VKEY_SPACE;
	case ';':return VKEY_SEMICOLON;
	case '=':return VKEY_EQUALS;
	case ',':return VKEY_COMMA;
	case '-':return VKEY_MINUS;
	case '.':return VKEY_PERIOD;
	case '/':return VKEY_SLASH;
	case '~':return VKEY_TILDE;
	case '[':return VKEY_OPENBRACKET;
	case ']':return VKEY_CLOSEBRACKET;
	case '\"':return VKEY_QUOTES;
	case '\\':return VKEY_BACKSLASH;
	
	case '`':return VKEY_TILDE;
	case '\'':return VKEY_QUOTES;

	case GLFW_KEY_LSHIFT:
	case GLFW_KEY_RSHIFT:return VKEY_SHIFT;
	case GLFW_KEY_LCTRL:
	case GLFW_KEY_RCTRL:return VKEY_CONTROL;
	
//	case GLFW_KEY_LSHIFT:return VKEY_LSHIFT;
//	case GLFW_KEY_RSHIFT:return VKEY_RSHIFT;
//	case GLFW_KEY_LCTRL:return VKEY_LCONTROL;
//	case GLFW_KEY_RCTRL:return VKEY_RCONTROL;
	
	case GLFW_KEY_BACKSPACE:return VKEY_BACKSPACE;
	case GLFW_KEY_TAB:return VKEY_TAB;
	case GLFW_KEY_ENTER:return VKEY_ENTER;
	case GLFW_KEY_ESC:return VKEY_ESC;
	case GLFW_KEY_INSERT:return VKEY_INSERT;
	case GLFW_KEY_DEL:return VKEY_DELETE;
	case GLFW_KEY_PAGEUP:return VKEY_PAGEUP;
	case GLFW_KEY_PAGEDOWN:return VKEY_PAGEDOWN;
	case GLFW_KEY_HOME:return VKEY_HOME;
	case GLFW_KEY_END:return VKEY_END;
	case GLFW_KEY_UP:return VKEY_UP;
	case GLFW_KEY_DOWN:return VKEY_DOWN;
	case GLFW_KEY_LEFT:return VKEY_LEFT;
	case GLFW_KEY_RIGHT:return VKEY_RIGHT;
	
	case GLFW_KEY_KP_0:return VKEY_NUM0;
	case GLFW_KEY_KP_1:return VKEY_NUM1;
	case GLFW_KEY_KP_2:return VKEY_NUM2;
	case GLFW_KEY_KP_3:return VKEY_NUM3;
	case GLFW_KEY_KP_4:return VKEY_NUM4;
	case GLFW_KEY_KP_5:return VKEY_NUM5;
	case GLFW_KEY_KP_6:return VKEY_NUM6;
	case GLFW_KEY_KP_7:return VKEY_NUM7;
	case GLFW_KEY_KP_8:return VKEY_NUM8;
	case GLFW_KEY_KP_9:return VKEY_NUM9;
	case GLFW_KEY_KP_DIVIDE:return VKEY_NUMDIVIDE;
	case GLFW_KEY_KP_MULTIPLY:return VKEY_NUMMULTIPLY;
	case GLFW_KEY_KP_SUBTRACT:return VKEY_NUMSUBTRACT;
	case GLFW_KEY_KP_ADD:return VKEY_NUMADD;
	case GLFW_KEY_KP_DECIMAL:return VKEY_NUMDECIMAL;
    	
	case GLFW_KEY_F1:return VKEY_F1;
	case GLFW_KEY_F2:return VKEY_F2;
	case GLFW_KEY_F3:return VKEY_F3;
	case GLFW_KEY_F4:return VKEY_F4;
	case GLFW_KEY_F5:return VKEY_F5;
	case GLFW_KEY_F6:return VKEY_F6;
	case GLFW_KEY_F7:return VKEY_F7;
	case GLFW_KEY_F8:return VKEY_F8;
	case GLFW_KEY_F9:return VKEY_F9;
	case GLFW_KEY_F10:return VKEY_F10;
	case GLFW_KEY_F11:return VKEY_F11;
	case GLFW_KEY_F12:return VKEY_F12;
	}
	return 0;
}

//monkey key to special monkey char
int BBGlfwGame::KeyToChar( int key ){
	switch( key ){
	case VKEY_BACKSPACE:
	case VKEY_TAB:
	case VKEY_ENTER:
	case VKEY_ESC:
		return key;
	case VKEY_PAGEUP:
	case VKEY_PAGEDOWN:
	case VKEY_END:
	case VKEY_HOME:
	case VKEY_LEFT:
	case VKEY_UP:
	case VKEY_RIGHT:
	case VKEY_DOWN:
	case VKEY_INSERT:
		return key | 0x10000;
	case VKEY_DELETE:
		return 127;
	}
	return 0;
}

void BBGlfwGame::OnMouseButton( int button,int action ){
	switch( button ){
	case GLFW_MOUSE_BUTTON_LEFT:button=0;break;
	case GLFW_MOUSE_BUTTON_RIGHT:button=1;break;
	case GLFW_MOUSE_BUTTON_MIDDLE:button=2;break;
	default:return;
	}
	int x,y;
	glfwGetMousePos( &x,&y );
	switch( action ){
	case GLFW_PRESS:
		_glfwGame->MouseEvent( BBGameEvent::MouseDown,button,x,y );
		break;
	case GLFW_RELEASE:
		_glfwGame->MouseEvent( BBGameEvent::MouseUp,button,x,y );
		break;
	}
}

void BBGlfwGame::OnMousePos( int x,int y ){
	_game->MouseEvent( BBGameEvent::MouseMove,-1,x,y );
}

int BBGlfwGame::OnWindowClose(){
	_game->KeyEvent( BBGameEvent::KeyDown,0x1b0 );
	_game->KeyEvent( BBGameEvent::KeyUp,0x1b0 );
	return GL_FALSE;
}

void BBGlfwGame::OnKey( int key,int action ){

	key=TransKey( key );
	if( !key ) return;
	
	switch( action ){
	case GLFW_PRESS:
		_glfwGame->KeyEvent( BBGameEvent::KeyDown,key );
		if( int chr=KeyToChar( key ) ) _game->KeyEvent( BBGameEvent::KeyChar,chr );
		break;
	case GLFW_RELEASE:
		_glfwGame->KeyEvent( BBGameEvent::KeyUp,key );
		break;
	}
}

void BBGlfwGame::OnChar( int chr,int action ){

	switch( action ){
	case GLFW_PRESS:
		_glfwGame->KeyEvent( BBGameEvent::KeyChar,chr );
		break;
	}
}

void BBGlfwGame::SetGlfwWindow( int width,int height,int red,int green,int blue,int alpha,int depth,int stencil,bool fullscreen ){

	for( int i=0;i<=GLFW_KEY_LAST;++i ){
		int key=TransKey( i );
		if( key && glfwGetKey( i )==GLFW_PRESS ) KeyEvent( BBGameEvent::KeyUp,key );
	}

	GLFWvidmode desktopMode;
	glfwGetDesktopMode( &desktopMode );

	glfwCloseWindow();
	
	glfwOpenWindowHint( GLFW_REFRESH_RATE,60 );
	glfwOpenWindowHint( GLFW_WINDOW_NO_RESIZE,CFG_GLFW_WINDOW_RESIZABLE ? GL_FALSE : GL_TRUE );

	glfwOpenWindow( width,height,red,green,blue,alpha,depth,stencil,fullscreen ? GLFW_FULLSCREEN : GLFW_WINDOW );

	++glfwGraphicsSeq;

	if( !fullscreen ){	
		glfwSetWindowPos( (desktopMode.Width-width)/2,(desktopMode.Height-height)/2 );
		glfwSetWindowTitle( _STRINGIZE(CFG_GLFW_WINDOW_TITLE) );
	}

#if CFG_OPENGL_INIT_EXTENSIONS
	Init_GL_Exts();
#endif

	if( _swapInterval>=0 ) glfwSwapInterval( _swapInterval );

	glfwEnable( GLFW_KEY_REPEAT );
	glfwDisable( GLFW_AUTO_POLL_EVENTS );
	glfwSetKeyCallback( OnKey );
	glfwSetCharCallback( OnChar );
	glfwSetMouseButtonCallback( OnMouseButton );
	glfwSetMousePosCallback( OnMousePos );
	glfwSetWindowCloseCallback(	OnWindowClose );
}

Array<BBGlfwVideoMode*> BBGlfwGame::GetGlfwVideoModes(){
	GLFWvidmode modes[1024];
	int n=glfwGetVideoModes( modes,1024 );
	Array<BBGlfwVideoMode*> bbmodes( n );
	for( int i=0;i<n;++i ){
		bbmodes[i]=new BBGlfwVideoMode( modes[i].Width,modes[i].Height,modes[i].RedBits,modes[i].GreenBits,modes[i].BlueBits );
	}
	return bbmodes;
}

BBGlfwVideoMode *BBGlfwGame::GetGlfwDesktopMode(){
	GLFWvidmode mode;
	glfwGetDesktopMode( &mode );
	return new BBGlfwVideoMode( mode.Width,mode.Height,mode.RedBits,mode.GreenBits,mode.BlueBits );
}

int BBGlfwGame::GetDeviceWidth(){
	int width,height;
	glfwGetWindowSize( &width,&height );
	return width;
}

int BBGlfwGame::GetDeviceHeight(){
	int width,height;
	glfwGetWindowSize( &width,&height );
	return height;
}

void BBGlfwGame::SetDeviceWindow( int width,int height,int flags ){

	SetGlfwWindow( width,height,8,8,8,0,CFG_OPENGL_DEPTH_BUFFER_ENABLED ? 32 : 0,0,(flags&1)!=0 );
}

Array<BBDisplayMode*> BBGlfwGame::GetDisplayModes(){

	GLFWvidmode vmodes[1024];
	int n=glfwGetVideoModes( vmodes,1024 );
	Array<BBDisplayMode*> modes( n );
	for( int i=0;i<n;++i ) modes[i]=new BBDisplayMode( vmodes[i].Width,vmodes[i].Height );
	return modes;
}

BBDisplayMode *BBGlfwGame::GetDesktopMode(){

	GLFWvidmode vmode;
	glfwGetDesktopMode( &vmode );
	return new BBDisplayMode( vmode.Width,vmode.Height );
}

void BBGlfwGame::SetSwapInterval( int interval ){
	_swapInterval=interval;
	if( _swapInterval>=0 ) glfwSwapInterval( _swapInterval );
}

void BBGlfwGame::UpdateEvents(){
	if( _suspended ){
		glfwWaitEvents();
	}else{
		glfwPollEvents();
	}
	if( glfwGetWindowParam( GLFW_ACTIVE ) ){
		if( _suspended ){
			ResumeGame();
			_nextUpdate=0;
		}
	}else if( glfwGetWindowParam( GLFW_ICONIFIED ) || CFG_MOJO_AUTO_SUSPEND_ENABLED ){
		if( !_suspended ){
			SuspendGame();
			_nextUpdate=0;
		}
	}
}

void BBGlfwGame::Run(){

#if	CFG_GLFW_WINDOW_WIDTH && CFG_GLFW_WINDOW_HEIGHT

	SetGlfwWindow( CFG_GLFW_WINDOW_WIDTH,CFG_GLFW_WINDOW_HEIGHT,8,8,8,0,CFG_OPENGL_DEPTH_BUFFER_ENABLED ? 32 : 0,0,CFG_GLFW_WINDOW_FULLSCREEN );

#endif

	StartGame();
	
	while( glfwGetWindowParam( GLFW_OPENED ) ){
	
		RenderGame();
		glfwSwapBuffers();
		
		if( _nextUpdate ){
			double delay=_nextUpdate-glfwGetTime();
			if( delay>0 ) glfwSleep( delay );
		}
		
		//Update user events
		UpdateEvents();

		//App suspended?		
		if( _suspended ) continue;

		//'Go nuts' mode!
		if( !_updateRate ){
			UpdateGame();
			continue;
		}
		
		//Reset update timer?
		if( !_nextUpdate ) _nextUpdate=glfwGetTime();
		
		//Catch up updates...
		int i=0;
		for( ;i<4;++i ){
		
			UpdateGame();
			if( !_nextUpdate ) break;
			
			_nextUpdate+=_updatePeriod;
			
			if( _nextUpdate>glfwGetTime() ) break;
		}
		
		if( i==4 ) _nextUpdate=0;
	}
}



//***** monkeygame.h *****

class BBMonkeyGame : public BBGlfwGame{
public:

	static void Main( int args,const char *argv[] );
};

//***** monkeygame.cpp *****

#define _QUOTE(X) #X
#define _STRINGIZE(X) _QUOTE(X)

void BBMonkeyGame::Main( int argc,const char *argv[] ){

	if( !glfwInit() ){
		puts( "glfwInit failed" );
		exit(-1);
	}

	BBMonkeyGame *game=new BBMonkeyGame();
	
	try{
	
		bb_std_main( argc,argv );
		
	}catch( ThrowableObject *ex ){
	
		glfwTerminate();
		
		game->Die( ex );
		
		return;
	}

	if( game->Delegate() ) game->Run();
	
	glfwTerminate();
}


// GLFW mojo runtime.
//
// Copyright 2011 Mark Sibly, all rights reserved.
// No warranty implied; use at your own risk.

//***** gxtkGraphics.h *****

class gxtkSurface;

class gxtkGraphics : public Object{
public:

	enum{
		MAX_VERTS=1024,
		MAX_QUADS=(MAX_VERTS/4)
	};

	int width;
	int height;

	int colorARGB;
	float r,g,b,alpha;
	float ix,iy,jx,jy,tx,ty;
	bool tformed;

	float vertices[MAX_VERTS*5];
	unsigned short quadIndices[MAX_QUADS*6];

	int primType;
	int vertCount;
	gxtkSurface *primSurf;
	
	gxtkGraphics();
	
	void Flush();
	float *Begin( int type,int count,gxtkSurface *surf );
	
	//***** GXTK API *****
	virtual int Width();
	virtual int Height();
	
	virtual int  BeginRender();
	virtual void EndRender();
	virtual void DiscardGraphics();

	virtual gxtkSurface *LoadSurface( String path );
	virtual gxtkSurface *LoadSurface__UNSAFE__( gxtkSurface *surface,String path );
	virtual gxtkSurface *CreateSurface( int width,int height );
	
	virtual int Cls( float r,float g,float b );
	virtual int SetAlpha( float alpha );
	virtual int SetColor( float r,float g,float b );
	virtual int SetBlend( int blend );
	virtual int SetScissor( int x,int y,int w,int h );
	virtual int SetMatrix( float ix,float iy,float jx,float jy,float tx,float ty );
	
	virtual int DrawPoint( float x,float y );
	virtual int DrawRect( float x,float y,float w,float h );
	virtual int DrawLine( float x1,float y1,float x2,float y2 );
	virtual int DrawOval( float x1,float y1,float x2,float y2 );
	virtual int DrawPoly( Array<Float> verts );
	virtual int DrawPoly2( Array<Float> verts,gxtkSurface *surface,int srcx,int srcy );
	virtual int DrawSurface( gxtkSurface *surface,float x,float y );
	virtual int DrawSurface2( gxtkSurface *surface,float x,float y,int srcx,int srcy,int srcw,int srch );
	
	virtual int ReadPixels( Array<int> pixels,int x,int y,int width,int height,int offset,int pitch );
	virtual int WritePixels2( gxtkSurface *surface,Array<int> pixels,int x,int y,int width,int height,int offset,int pitch );
};

class gxtkSurface : public Object{
public:
	unsigned char *data;
	int width;
	int height;
	int depth;
	int format;
	int seq;
	
	GLuint texture;
	float uscale;
	float vscale;
	
	gxtkSurface();
	
	void SetData( unsigned char *data,int width,int height,int depth );
	void SetSubData( int x,int y,int w,int h,unsigned *src,int pitch );
	void Bind();
	
	~gxtkSurface();
	
	//***** GXTK API *****
	virtual int Discard();
	virtual int Width();
	virtual int Height();
	virtual int Loaded();
	virtual bool OnUnsafeLoadComplete();
};

//***** gxtkGraphics.cpp *****

#ifndef GL_BGRA
#define GL_BGRA  0x80e1
#endif

#ifndef GL_CLAMP_TO_EDGE
#define GL_CLAMP_TO_EDGE 0x812f
#endif

#ifndef GL_GENERATE_MIPMAP
#define GL_GENERATE_MIPMAP 0x8191
#endif

static int Pow2Size( int n ){
	int i=1;
	while( i<n ) i+=i;
	return i;
}

gxtkGraphics::gxtkGraphics(){

	width=height=0;
#ifdef _glfw3_h_
	GLFWwindow *window=BBGlfwGame::GlfwGame()->GetGLFWwindow();
	if( window ) glfwGetWindowSize( BBGlfwGame::GlfwGame()->GetGLFWwindow(),&width,&height );
#else
	glfwGetWindowSize( &width,&height );
#endif
	
	if( CFG_OPENGL_GLES20_ENABLED ) return;
	
	for( int i=0;i<MAX_QUADS;++i ){
		quadIndices[i*6  ]=(short)(i*4);
		quadIndices[i*6+1]=(short)(i*4+1);
		quadIndices[i*6+2]=(short)(i*4+2);
		quadIndices[i*6+3]=(short)(i*4);
		quadIndices[i*6+4]=(short)(i*4+2);
		quadIndices[i*6+5]=(short)(i*4+3);
	}
}

void gxtkGraphics::Flush(){
	if( !vertCount ) return;

	if( primSurf ){
		glEnable( GL_TEXTURE_2D );
		primSurf->Bind();
	}
		
	switch( primType ){
	case 1:
		glDrawArrays( GL_POINTS,0,vertCount );
		break;
	case 2:
		glDrawArrays( GL_LINES,0,vertCount );
		break;
	case 3:
		glDrawArrays( GL_TRIANGLES,0,vertCount );
		break;
	case 4:
		glDrawElements( GL_TRIANGLES,vertCount/4*6,GL_UNSIGNED_SHORT,quadIndices );
		break;
	default:
		for( int j=0;j<vertCount;j+=primType ){
			glDrawArrays( GL_TRIANGLE_FAN,j,primType );
		}
		break;
	}

	if( primSurf ){
		glDisable( GL_TEXTURE_2D );
	}

	vertCount=0;
}

float *gxtkGraphics::Begin( int type,int count,gxtkSurface *surf ){
	if( primType!=type || primSurf!=surf || vertCount+count>MAX_VERTS ){
		Flush();
		primType=type;
		primSurf=surf;
	}
	float *vp=vertices+vertCount*5;
	vertCount+=count;
	return vp;
}

//***** GXTK API *****

int gxtkGraphics::Width(){
	return width;
}

int gxtkGraphics::Height(){
	return height;
}

int gxtkGraphics::BeginRender(){

	width=height=0;
#ifdef _glfw3_h_
	glfwGetWindowSize( BBGlfwGame::GlfwGame()->GetGLFWwindow(),&width,&height );
#else
	glfwGetWindowSize( &width,&height );
#endif
	
	if( CFG_OPENGL_GLES20_ENABLED ) return 0;
	
	glViewport( 0,0,width,height );

	glMatrixMode( GL_PROJECTION );
	glLoadIdentity();
	glOrtho( 0,width,height,0,-1,1 );
	glMatrixMode( GL_MODELVIEW );
	glLoadIdentity();
	
	glEnableClientState( GL_VERTEX_ARRAY );
	glVertexPointer( 2,GL_FLOAT,20,&vertices[0] );	
	
	glEnableClientState( GL_TEXTURE_COORD_ARRAY );
	glTexCoordPointer( 2,GL_FLOAT,20,&vertices[2] );
	
	glEnableClientState( GL_COLOR_ARRAY );
	glColorPointer( 4,GL_UNSIGNED_BYTE,20,&vertices[4] );
	
	glEnable( GL_BLEND );
	glBlendFunc( GL_ONE,GL_ONE_MINUS_SRC_ALPHA );
	
	glDisable( GL_TEXTURE_2D );
	
	vertCount=0;
	
	return 1;
}

void gxtkGraphics::EndRender(){
	if( !CFG_OPENGL_GLES20_ENABLED ) Flush();
}

void gxtkGraphics::DiscardGraphics(){
}

int gxtkGraphics::Cls( float r,float g,float b ){
	vertCount=0;

	glClearColor( r/255.0f,g/255.0f,b/255.0f,1 );
	glClear( GL_COLOR_BUFFER_BIT );

	return 0;
}

int gxtkGraphics::SetAlpha( float alpha ){
	this->alpha=alpha;
	
	int a=int(alpha*255);
	
	colorARGB=(a<<24) | (int(b*alpha)<<16) | (int(g*alpha)<<8) | int(r*alpha);
	
	return 0;
}

int gxtkGraphics::SetColor( float r,float g,float b ){
	this->r=r;
	this->g=g;
	this->b=b;

	int a=int(alpha*255);
	
	colorARGB=(a<<24) | (int(b*alpha)<<16) | (int(g*alpha)<<8) | int(r*alpha);
	
	return 0;
}

int gxtkGraphics::SetBlend( int blend ){

	Flush();
	
	switch( blend ){
	case 1:
		glBlendFunc( GL_ONE,GL_ONE );
		break;
	default:
		glBlendFunc( GL_ONE,GL_ONE_MINUS_SRC_ALPHA );
	}

	return 0;
}

int gxtkGraphics::SetScissor( int x,int y,int w,int h ){

	Flush();
	
	if( x!=0 || y!=0 || w!=Width() || h!=Height() ){
		glEnable( GL_SCISSOR_TEST );
		y=Height()-y-h;
		glScissor( x,y,w,h );
	}else{
		glDisable( GL_SCISSOR_TEST );
	}
	return 0;
}

int gxtkGraphics::SetMatrix( float ix,float iy,float jx,float jy,float tx,float ty ){

	tformed=(ix!=1 || iy!=0 || jx!=0 || jy!=1 || tx!=0 || ty!=0);

	this->ix=ix;this->iy=iy;this->jx=jx;this->jy=jy;this->tx=tx;this->ty=ty;

	return 0;
}

int gxtkGraphics::DrawPoint( float x,float y ){

	if( tformed ){
		float px=x;
		x=px * ix + y * jx + tx;
		y=px * iy + y * jy + ty;
	}
	
	float *vp=Begin( 1,1,0 );
	
	vp[0]=x;vp[1]=y;(int&)vp[4]=colorARGB;

	return 0;	
}
	
int gxtkGraphics::DrawLine( float x0,float y0,float x1,float y1 ){

	if( tformed ){
		float tx0=x0,tx1=x1;
		x0=tx0 * ix + y0 * jx + tx;y0=tx0 * iy + y0 * jy + ty;
		x1=tx1 * ix + y1 * jx + tx;y1=tx1 * iy + y1 * jy + ty;
	}
	
	float *vp=Begin( 2,2,0 );

	vp[0]=x0;vp[1]=y0;(int&)vp[4]=colorARGB;
	vp[5]=x1;vp[6]=y1;(int&)vp[9]=colorARGB;
	
	return 0;
}

int gxtkGraphics::DrawRect( float x,float y,float w,float h ){

	float x0=x,x1=x+w,x2=x+w,x3=x;
	float y0=y,y1=y,y2=y+h,y3=y+h;

	if( tformed ){
		float tx0=x0,tx1=x1,tx2=x2,tx3=x3;
		x0=tx0 * ix + y0 * jx + tx;y0=tx0 * iy + y0 * jy + ty;
		x1=tx1 * ix + y1 * jx + tx;y1=tx1 * iy + y1 * jy + ty;
		x2=tx2 * ix + y2 * jx + tx;y2=tx2 * iy + y2 * jy + ty;
		x3=tx3 * ix + y3 * jx + tx;y3=tx3 * iy + y3 * jy + ty;
	}
	
	float *vp=Begin( 4,4,0 );

	vp[0 ]=x0;vp[1 ]=y0;(int&)vp[4 ]=colorARGB;
	vp[5 ]=x1;vp[6 ]=y1;(int&)vp[9 ]=colorARGB;
	vp[10]=x2;vp[11]=y2;(int&)vp[14]=colorARGB;
	vp[15]=x3;vp[16]=y3;(int&)vp[19]=colorARGB;

	return 0;
}

int gxtkGraphics::DrawOval( float x,float y,float w,float h ){
	
	float xr=w/2.0f;
	float yr=h/2.0f;

	int n;
	if( tformed ){
		float dx_x=xr * ix;
		float dx_y=xr * iy;
		float dx=sqrtf( dx_x*dx_x+dx_y*dx_y );
		float dy_x=yr * jx;
		float dy_y=yr * jy;
		float dy=sqrtf( dy_x*dy_x+dy_y*dy_y );
		n=(int)( dx+dy );
	}else{
		n=(int)( abs( xr )+abs( yr ) );
	}
	
	if( n<12 ){
		n=12;
	}else if( n>MAX_VERTS ){
		n=MAX_VERTS;
	}else{
		n&=~3;
	}

	float x0=x+xr,y0=y+yr;
	
	float *vp=Begin( n,n,0 );

	for( int i=0;i<n;++i ){
	
		float th=i * 6.28318531f / n;

		float px=x0+cosf( th ) * xr;
		float py=y0-sinf( th ) * yr;
		
		if( tformed ){
			float ppx=px;
			px=ppx * ix + py * jx + tx;
			py=ppx * iy + py * jy + ty;
		}
		
		vp[0]=px;vp[1]=py;(int&)vp[4]=colorARGB;
		vp+=5;
	}
	
	return 0;
}

int gxtkGraphics::DrawPoly( Array<Float> verts ){

	int n=verts.Length()/2;
	if( n<1 || n>MAX_VERTS ) return 0;
	
	float *vp=Begin( n,n,0 );
	
	for( int i=0;i<n;++i ){
		int j=i*2;
		if( tformed ){
			vp[0]=verts[j] * ix + verts[j+1] * jx + tx;
			vp[1]=verts[j] * iy + verts[j+1] * jy + ty;
		}else{
			vp[0]=verts[j];
			vp[1]=verts[j+1];
		}
		(int&)vp[4]=colorARGB;
		vp+=5;
	}

	return 0;
}

int gxtkGraphics::DrawPoly2( Array<Float> verts,gxtkSurface *surface,int srcx,int srcy ){

	int n=verts.Length()/4;
	if( n<1 || n>MAX_VERTS ) return 0;
		
	float *vp=Begin( n,n,surface );
	
	for( int i=0;i<n;++i ){
		int j=i*4;
		if( tformed ){
			vp[0]=verts[j] * ix + verts[j+1] * jx + tx;
			vp[1]=verts[j] * iy + verts[j+1] * jy + ty;
		}else{
			vp[0]=verts[j];
			vp[1]=verts[j+1];
		}
		vp[2]=(srcx+verts[j+2])*surface->uscale;
		vp[3]=(srcy+verts[j+3])*surface->vscale;
		(int&)vp[4]=colorARGB;
		vp+=5;
	}
	
	return 0;
}

int gxtkGraphics::DrawSurface( gxtkSurface *surf,float x,float y ){
	
	float w=surf->Width();
	float h=surf->Height();
	float x0=x,x1=x+w,x2=x+w,x3=x;
	float y0=y,y1=y,y2=y+h,y3=y+h;
	float u0=0,u1=w*surf->uscale;
	float v0=0,v1=h*surf->vscale;

	if( tformed ){
		float tx0=x0,tx1=x1,tx2=x2,tx3=x3;
		x0=tx0 * ix + y0 * jx + tx;y0=tx0 * iy + y0 * jy + ty;
		x1=tx1 * ix + y1 * jx + tx;y1=tx1 * iy + y1 * jy + ty;
		x2=tx2 * ix + y2 * jx + tx;y2=tx2 * iy + y2 * jy + ty;
		x3=tx3 * ix + y3 * jx + tx;y3=tx3 * iy + y3 * jy + ty;
	}
	
	float *vp=Begin( 4,4,surf );
	
	vp[0 ]=x0;vp[1 ]=y0;vp[2 ]=u0;vp[3 ]=v0;(int&)vp[4 ]=colorARGB;
	vp[5 ]=x1;vp[6 ]=y1;vp[7 ]=u1;vp[8 ]=v0;(int&)vp[9 ]=colorARGB;
	vp[10]=x2;vp[11]=y2;vp[12]=u1;vp[13]=v1;(int&)vp[14]=colorARGB;
	vp[15]=x3;vp[16]=y3;vp[17]=u0;vp[18]=v1;(int&)vp[19]=colorARGB;
	
	return 0;
}

int gxtkGraphics::DrawSurface2( gxtkSurface *surf,float x,float y,int srcx,int srcy,int srcw,int srch ){
	
	float w=srcw;
	float h=srch;
	float x0=x,x1=x+w,x2=x+w,x3=x;
	float y0=y,y1=y,y2=y+h,y3=y+h;
	float u0=srcx*surf->uscale,u1=(srcx+srcw)*surf->uscale;
	float v0=srcy*surf->vscale,v1=(srcy+srch)*surf->vscale;

	if( tformed ){
		float tx0=x0,tx1=x1,tx2=x2,tx3=x3;
		x0=tx0 * ix + y0 * jx + tx;y0=tx0 * iy + y0 * jy + ty;
		x1=tx1 * ix + y1 * jx + tx;y1=tx1 * iy + y1 * jy + ty;
		x2=tx2 * ix + y2 * jx + tx;y2=tx2 * iy + y2 * jy + ty;
		x3=tx3 * ix + y3 * jx + tx;y3=tx3 * iy + y3 * jy + ty;
	}
	
	float *vp=Begin( 4,4,surf );
	
	vp[0 ]=x0;vp[1 ]=y0;vp[2 ]=u0;vp[3 ]=v0;(int&)vp[4 ]=colorARGB;
	vp[5 ]=x1;vp[6 ]=y1;vp[7 ]=u1;vp[8 ]=v0;(int&)vp[9 ]=colorARGB;
	vp[10]=x2;vp[11]=y2;vp[12]=u1;vp[13]=v1;(int&)vp[14]=colorARGB;
	vp[15]=x3;vp[16]=y3;vp[17]=u0;vp[18]=v1;(int&)vp[19]=colorARGB;
	
	return 0;
}
	
int gxtkGraphics::ReadPixels( Array<int> pixels,int x,int y,int width,int height,int offset,int pitch ){

	Flush();

	unsigned *p=(unsigned*)malloc(width*height*4);

	glReadPixels( x,this->height-y-height,width,height,GL_BGRA,GL_UNSIGNED_BYTE,p );
	
	for( int py=0;py<height;++py ){
		memcpy( &pixels[offset+py*pitch],&p[(height-py-1)*width],width*4 );
	}
	
	free( p );
	
	return 0;
}

int gxtkGraphics::WritePixels2( gxtkSurface *surface,Array<int> pixels,int x,int y,int width,int height,int offset,int pitch ){

	Flush();
	
	surface->SetSubData( x,y,width,height,(unsigned*)&pixels[offset],pitch );
	
	return 0;
}

//***** gxtkSurface *****

gxtkSurface::gxtkSurface():data(0),width(0),height(0),depth(0),format(0),seq(-1),texture(0),uscale(0),vscale(0){
}

gxtkSurface::~gxtkSurface(){
	Discard();
}

int gxtkSurface::Discard(){
	if( seq==glfwGraphicsSeq ){
		glDeleteTextures( 1,&texture );
		seq=-1;
	}
	if( data ){
		free( data );
		data=0;
	}
	return 0;
}

int gxtkSurface::Width(){
	return width;
}

int gxtkSurface::Height(){
	return height;
}

int gxtkSurface::Loaded(){
	return 1;
}

//Careful! Can't call any GL here as it may be executing off-thread.
//
void gxtkSurface::SetData( unsigned char *data,int width,int height,int depth ){

	this->data=data;
	this->width=width;
	this->height=height;
	this->depth=depth;
	
	unsigned char *p=data;
	int n=width*height;
	
	switch( depth ){
	case 1:
		format=GL_LUMINANCE;
		break;
	case 2:
		format=GL_LUMINANCE_ALPHA;
		if( data ){
			while( n-- ){	//premultiply alpha
				p[0]=p[0]*p[1]/255;
				p+=2;
			}
		}
		break;
	case 3:
		format=GL_RGB;
		break;
	case 4:
		format=GL_RGBA;
		if( data ){
			while( n-- ){	//premultiply alpha
				p[0]=p[0]*p[3]/255;
				p[1]=p[1]*p[3]/255;
				p[2]=p[2]*p[3]/255;
				p+=4;
			}
		}
		break;
	}
}

void gxtkSurface::SetSubData( int x,int y,int w,int h,unsigned *src,int pitch ){
	if( format!=GL_RGBA ) return;
	
	if( !data ) data=(unsigned char*)malloc( width*height*4 );
	
	unsigned *dst=(unsigned*)data+y*width+x;
	
	for( int py=0;py<h;++py ){
		unsigned *d=dst+py*width;
		unsigned *s=src+py*pitch;
		for( int px=0;px<w;++px ){
			unsigned p=*s++;
			unsigned a=p>>24;
			*d++=(a<<24) | ((p>>0&0xff)*a/255<<16) | ((p>>8&0xff)*a/255<<8) | ((p>>16&0xff)*a/255);
		}
	}
	
	if( seq==glfwGraphicsSeq ){
		glBindTexture( GL_TEXTURE_2D,texture );
		glPixelStorei( GL_UNPACK_ALIGNMENT,1 );
		if( width==pitch ){
			glTexSubImage2D( GL_TEXTURE_2D,0,x,y,w,h,format,GL_UNSIGNED_BYTE,dst );
		}else{
			for( int py=0;py<h;++py ){
				glTexSubImage2D( GL_TEXTURE_2D,0,x,y+py,w,1,format,GL_UNSIGNED_BYTE,dst+py*width );
			}
		}
	}
}

void gxtkSurface::Bind(){

	if( !glfwGraphicsSeq ) return;
	
	if( seq==glfwGraphicsSeq ){
		glBindTexture( GL_TEXTURE_2D,texture );
		return;
	}
	
	seq=glfwGraphicsSeq;
	
	glGenTextures( 1,&texture );
	glBindTexture( GL_TEXTURE_2D,texture );
	
	if( CFG_MOJO_IMAGE_FILTERING_ENABLED ){
		glTexParameteri( GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR );
		glTexParameteri( GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR );
	}else{
		glTexParameteri( GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST );
		glTexParameteri( GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST );
	}

	glTexParameteri( GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE );
	glTexParameteri( GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE );

	int texwidth=width;
	int texheight=height;
	
	glTexImage2D( GL_TEXTURE_2D,0,format,texwidth,texheight,0,format,GL_UNSIGNED_BYTE,0 );
	if( glGetError()!=GL_NO_ERROR ){
		texwidth=Pow2Size( width );
		texheight=Pow2Size( height );
		glTexImage2D( GL_TEXTURE_2D,0,format,texwidth,texheight,0,format,GL_UNSIGNED_BYTE,0 );
	}
	
	uscale=1.0/texwidth;
	vscale=1.0/texheight;
	
	if( data ){
		glPixelStorei( GL_UNPACK_ALIGNMENT,1 );
		glTexSubImage2D( GL_TEXTURE_2D,0,0,0,width,height,format,GL_UNSIGNED_BYTE,data );
	}
}

bool gxtkSurface::OnUnsafeLoadComplete(){
	Bind();
	return true;
}

gxtkSurface *gxtkGraphics::LoadSurface__UNSAFE__( gxtkSurface *surface,String path ){
	int width,height,depth;
	unsigned char *data=BBGlfwGame::GlfwGame()->LoadImageData( path,&width,&height,&depth );
	if( !data ) return 0;
	surface->SetData( data,width,height,depth );
	return surface;
}

gxtkSurface *gxtkGraphics::LoadSurface( String path ){
	gxtkSurface *surf=LoadSurface__UNSAFE__( new gxtkSurface(),path );
	if( !surf ) return 0;
	surf->Bind();
	return surf;
}

gxtkSurface *gxtkGraphics::CreateSurface( int width,int height ){
	gxtkSurface *surf=new gxtkSurface();
	surf->SetData( 0,width,height,4 );
	surf->Bind();
	return surf;
}

//***** gxtkAudio.h *****

class gxtkSample;

class gxtkChannel{
public:
	ALuint source;
	gxtkSample *sample;
	int flags;
	int state;
	
	int AL_Source();
};

class gxtkAudio : public Object{
public:
	ALCdevice *alcDevice;
	ALCcontext *alcContext;
	gxtkChannel channels[33];

	gxtkAudio();

	virtual void mark();

	//***** GXTK API *****
	virtual int Suspend();
	virtual int Resume();

	virtual gxtkSample *LoadSample__UNSAFE__( gxtkSample *sample,String path );
	virtual gxtkSample *LoadSample( String path );
	virtual int PlaySample( gxtkSample *sample,int channel,int flags );

	virtual int StopChannel( int channel );
	virtual int PauseChannel( int channel );
	virtual int ResumeChannel( int channel );
	virtual int ChannelState( int channel );
	virtual int SetVolume( int channel,float volume );
	virtual int SetPan( int channel,float pan );
	virtual int SetRate( int channel,float rate );
	
	virtual int PlayMusic( String path,int flags );
	virtual int StopMusic();
	virtual int PauseMusic();
	virtual int ResumeMusic();
	virtual int MusicState();
	virtual int SetMusicVolume( float volume );
};

class gxtkSample : public Object{
public:
	ALuint al_buffer;

	gxtkSample();
	gxtkSample( ALuint buf );
	~gxtkSample();
	
	void SetBuffer( ALuint buf );
	
	//***** GXTK API *****
	virtual int Discard();
};

//***** gxtkAudio.cpp *****

static std::vector<ALuint> discarded;

static void FlushDiscarded( gxtkAudio *audio ){

	if( !discarded.size() ) return;
	
	for( int i=0;i<33;++i ){
		gxtkChannel *chan=&audio->channels[i];
		if( chan->state ){
			int state=0;
			alGetSourcei( chan->source,AL_SOURCE_STATE,&state );
			if( state==AL_STOPPED ) alSourcei( chan->source,AL_BUFFER,0 );
		}
	}
	
	std::vector<ALuint> out;
	
	for( int i=0;i<discarded.size();++i ){
		ALuint buf=discarded[i];
		alDeleteBuffers( 1,&buf );
		ALenum err=alGetError();
		if( err==AL_NO_ERROR ){
//			printf( "alDeleteBuffers OK!\n" );fflush( stdout );
		}else{
//			printf( "alDeleteBuffers failed...\n" );fflush( stdout );
			out.push_back( buf );
		}
	}
	discarded=out;
}

int gxtkChannel::AL_Source(){
	if( !source ) alGenSources( 1,&source );
	return source;
}

gxtkAudio::gxtkAudio(){

	if( alcDevice=alcOpenDevice( 0 ) ){
		if( alcContext=alcCreateContext( alcDevice,0 ) ){
			if( alcMakeContextCurrent( alcContext ) ){
				//alc all go!
			}else{
				bbPrint( "OpenAl error: alcMakeContextCurrent failed" );
			}
		}else{
			bbPrint( "OpenAl error: alcCreateContext failed" );
		}
	}else{
		bbPrint( "OpenAl error: alcOpenDevice failed" );
	}

	alDistanceModel( AL_NONE );
	
	memset( channels,0,sizeof(channels) );
}

void gxtkAudio::mark(){
	for( int i=0;i<33;++i ){
		gxtkChannel *chan=&channels[i];
		if( chan->state!=0 ){
			int state=0;
			alGetSourcei( chan->source,AL_SOURCE_STATE,&state );
			if( state!=AL_STOPPED ) gc_mark( chan->sample );
		}
	}
}

int gxtkAudio::Suspend(){
	for( int i=0;i<33;++i ){
		gxtkChannel *chan=&channels[i];
		if( chan->state==1 ){
			int state=0;
			alGetSourcei( chan->source,AL_SOURCE_STATE,&state );
			if( state==AL_PLAYING ) alSourcePause( chan->source );
		}
	}
	return 0;
}

int gxtkAudio::Resume(){
	for( int i=0;i<33;++i ){
		gxtkChannel *chan=&channels[i];
		if( chan->state==1 ){
			int state=0;
			alGetSourcei( chan->source,AL_SOURCE_STATE,&state );
			if( state==AL_PAUSED ) alSourcePlay( chan->source );
		}
	}
	return 0;
}

gxtkSample *gxtkAudio::LoadSample__UNSAFE__( gxtkSample *sample,String path ){

	int length=0;
	int channels=0;
	int format=0;
	int hertz=0;
	unsigned char *data=BBGlfwGame::GlfwGame()->LoadAudioData( path,&length,&channels,&format,&hertz );
	if( !data ) return 0;
	
	int al_format=0;
	if( format==1 && channels==1 ){
		al_format=AL_FORMAT_MONO8;
	}else if( format==1 && channels==2 ){
		al_format=AL_FORMAT_STEREO8;
	}else if( format==2 && channels==1 ){
		al_format=AL_FORMAT_MONO16;
	}else if( format==2 && channels==2 ){
		al_format=AL_FORMAT_STEREO16;
	}
	
	int size=length*channels*format;
	
	ALuint al_buffer;
	alGenBuffers( 1,&al_buffer );
	alBufferData( al_buffer,al_format,data,size,hertz );
	free( data );
	
	sample->SetBuffer( al_buffer );
	return sample;
}

gxtkSample *gxtkAudio::LoadSample( String path ){

	FlushDiscarded( this );

	return LoadSample__UNSAFE__( new gxtkSample(),path );
}

int gxtkAudio::PlaySample( gxtkSample *sample,int channel,int flags ){

	FlushDiscarded( this );
	
	gxtkChannel *chan=&channels[channel];
	
	chan->AL_Source();
	
	alSourceStop( chan->source );
	alSourcei( chan->source,AL_BUFFER,sample->al_buffer );
	alSourcei( chan->source,AL_LOOPING,flags ? 1 : 0 );
	alSourcePlay( chan->source );
	
	gc_assign( chan->sample,sample );

	chan->flags=flags;
	chan->state=1;

	return 0;
}

int gxtkAudio::StopChannel( int channel ){
	gxtkChannel *chan=&channels[channel];

	if( chan->state!=0 ){
		alSourceStop( chan->source );
		chan->state=0;
	}
	return 0;
}

int gxtkAudio::PauseChannel( int channel ){
	gxtkChannel *chan=&channels[channel];

	if( chan->state==1 ){
		int state=0;
		alGetSourcei( chan->source,AL_SOURCE_STATE,&state );
		if( state==AL_STOPPED ){
			chan->state=0;
		}else{
			alSourcePause( chan->source );
			chan->state=2;
		}
	}
	return 0;
}

int gxtkAudio::ResumeChannel( int channel ){
	gxtkChannel *chan=&channels[channel];

	if( chan->state==2 ){
		alSourcePlay( chan->source );
		chan->state=1;
	}
	return 0;
}

int gxtkAudio::ChannelState( int channel ){
	gxtkChannel *chan=&channels[channel];
	
	if( chan->state==1 ){
		int state=0;
		alGetSourcei( chan->source,AL_SOURCE_STATE,&state );
		if( state==AL_STOPPED ) chan->state=0;
	}
	return chan->state;
}

int gxtkAudio::SetVolume( int channel,float volume ){
	gxtkChannel *chan=&channels[channel];

	alSourcef( chan->AL_Source(),AL_GAIN,volume );
	return 0;
}

int gxtkAudio::SetPan( int channel,float pan ){
	gxtkChannel *chan=&channels[channel];
	
	float x=sinf( pan ),y=0,z=-cosf( pan );
	alSource3f( chan->AL_Source(),AL_POSITION,x,y,z );
	return 0;
}

int gxtkAudio::SetRate( int channel,float rate ){
	gxtkChannel *chan=&channels[channel];

	alSourcef( chan->AL_Source(),AL_PITCH,rate );
	return 0;
}

int gxtkAudio::PlayMusic( String path,int flags ){
	StopMusic();
	
	gxtkSample *music=LoadSample( path );
	if( !music ) return -1;
	
	PlaySample( music,32,flags );
	return 0;
}

int gxtkAudio::StopMusic(){
	StopChannel( 32 );
	return 0;
}

int gxtkAudio::PauseMusic(){
	PauseChannel( 32 );
	return 0;
}

int gxtkAudio::ResumeMusic(){
	ResumeChannel( 32 );
	return 0;
}

int gxtkAudio::MusicState(){
	return ChannelState( 32 );
}

int gxtkAudio::SetMusicVolume( float volume ){
	SetVolume( 32,volume );
	return 0;
}

gxtkSample::gxtkSample():
al_buffer(0){
}

gxtkSample::gxtkSample( ALuint buf ):
al_buffer(buf){
}

gxtkSample::~gxtkSample(){
	puts( "Discarding sample" );
	Discard();
}

void gxtkSample::SetBuffer( ALuint buf ){
	al_buffer=buf;
}

int gxtkSample::Discard(){
	if( al_buffer ){
		discarded.push_back( al_buffer );
		al_buffer=0;
	}
	return 0;
}


// ***** thread.h *****

#if __cplusplus_winrt

using namespace Windows::System::Threading;

#endif

class BBThread : public Object{
public:
	Object *result;
	
	BBThread();
	~BBThread();
	
	virtual void Start();
	virtual bool IsRunning();
	virtual Object *Result();
	virtual void SetResult( Object *result );
	
	virtual void Run__UNSAFE__();
	
	virtual void Wait();
	
private:

	enum{
		INIT=0,
		RUNNING=1,
		FINISHED=2
	};

	
	int _state;
	Object *_result;
	
#if __cplusplus_winrt

	friend class Launcher;

	class Launcher{
	
		friend class BBThread;
		BBThread *_thread;
		
		Launcher( BBThread *thread ):_thread(thread){
		}
		
		public:
		void operator()( IAsyncAction ^operation ){
			_thread->Run__UNSAFE__();
			_thread->_state=FINISHED;
		} 
	};

#elif _WIN32

	DWORD _id;
	HANDLE _handle;
	
	static DWORD WINAPI run( void *p );
	
#else

	pthread_t _handle;
	
	static void *run( void *p );
	
#endif

};

// ***** thread.cpp *****

BBThread::BBThread():_result( 0 ),_state( INIT ){
}

BBThread::~BBThread(){
	Wait();
}

bool BBThread::IsRunning(){
	return _state==RUNNING;
}

void BBThread::SetResult( Object *result ){
	_result=result;
}

Object *BBThread::Result(){
	return _result;
}

void BBThread::Run__UNSAFE__(){
}

#if __cplusplus_winrt

void BBThread::Start(){
	if( _state==RUNNING ) return;
	
	if( _state==FINISHED ) {}

	_result=0;
	
	_state=RUNNING;
	
	Launcher launcher( this );
	
	auto handler=ref new WorkItemHandler( launcher );
	
	ThreadPool::RunAsync( handler );
}

void BBThread::Wait(){
//	exit( -1 );
}

#elif _WIN32

void BBThread::Start(){
	if( _state==RUNNING ) return;
	
	if( _state==FINISHED ) CloseHandle( _handle );

	_state=RUNNING;

	_handle=CreateThread( 0,0,run,this,0,&_id );
	
//	_handle=CreateThread( 0,0,run,this,CREATE_SUSPENDED,&_id );
//	SetThreadPriority( _handle,THREAD_PRIORITY_ABOVE_NORMAL );
//	ResumeThread( _handle );
}

void BBThread::Wait(){
	if( _state==INIT ) return;

	WaitForSingleObject( _handle,INFINITE );
	CloseHandle( _handle );

	_state=INIT;
}

DWORD WINAPI BBThread::run( void *p ){
	BBThread *thread=(BBThread*)p;

	thread->Run__UNSAFE__();
	
	thread->_state=FINISHED;
	return 0;
}

#else

void BBThread::Start(){
	if( _state==RUNNING ) return;
	
	if( _state==FINISHED ) pthread_join( _handle,0 );

	_result=0;
		
	_state=RUNNING;
	
	pthread_create( &_handle,0,run,this );
}

void BBThread::Wait(){
	if( _state==INIT ) return;
	
	pthread_join( _handle,0 );
	
	_state=INIT;
}

void *BBThread::run( void *p ){
	BBThread *thread=(BBThread*)p;

	thread->Run__UNSAFE__();

	thread->_state=FINISHED;
	return 0;
}

#endif


// ***** databuffer.h *****

class BBDataBuffer : public Object{
public:
	
	BBDataBuffer();
	
	~BBDataBuffer();
	
	bool _New( int length,void *data=0 );
	
	bool _Load( String path );
	
	void _LoadAsync( String path,BBThread *thread );

	void Discard();
	
	const void *ReadPointer( int offset=0 ){
		return _data+offset;
	}
	
	void *WritePointer( int offset=0 ){
		return _data+offset;
	}
	
	int Length(){
		return _length;
	}
	
	void PokeByte( int addr,int value ){
		*(_data+addr)=value;
	}

	void PokeShort( int addr,int value ){
		*(short*)(_data+addr)=value;
	}
	
	void PokeInt( int addr,int value ){
		*(int*)(_data+addr)=value;
	}
	
	void PokeFloat( int addr,float value ){
		*(float*)(_data+addr)=value;
	}

	int PeekByte( int addr ){
		return *(_data+addr);
	}
	
	int PeekShort( int addr ){
		return *(short*)(_data+addr);
	}
	
	int PeekInt( int addr ){
		return *(int*)(_data+addr);
	}
	
	float PeekFloat( int addr ){
		return *(float*)(_data+addr);
	}
	
private:
	signed char *_data;
	int _length;
};

// ***** databuffer.cpp *****

BBDataBuffer::BBDataBuffer():_data(0),_length(0){
}

BBDataBuffer::~BBDataBuffer(){
	if( _data ) free( _data );
}

bool BBDataBuffer::_New( int length,void *data ){
	if( _data ) return false;
	if( !data ) data=malloc( length );
	_data=(signed char*)data;
	_length=length;
	return true;
}

bool BBDataBuffer::_Load( String path ){
	if( _data ) return false;
	
	_data=(signed char*)BBGame::Game()->LoadData( path,&_length );
	if( !_data ) return false;
	
	return true;
}

void BBDataBuffer::_LoadAsync( String path,BBThread *thread ){
	if( _Load( path ) ) thread->SetResult( this );
}

void BBDataBuffer::Discard(){
	if( !_data ) return;
	free( _data );
	_data=0;
	_length=0;
}


#if _WIN32

#define INIT_GL_EXTS 1

//1.3
void (__stdcall* glActiveTexture)( GLenum texture );
void (__stdcall* glClientActiveTexture)( GLenum texture );
void (__stdcall* glCompressedTexImage2D)( GLenum target,GLint level,GLenum internalformat,GLsizei width,GLsizei height,GLint border,GLsizei imageSize,const GLvoid *data );
void (__stdcall* glCompressedTexSubImage2D)( GLenum target,GLint level,GLint xoffset,GLint yoffset,GLsizei width,GLsizei height,GLenum format,GLsizei imageSize,const GLvoid *data );
void (__stdcall* glMultiTexCoord4f)( GLenum target,GLfloat s,GLfloat t,GLfloat r,GLfloat q );
void (__stdcall* glSampleCoverage)( GLclampf value,GLboolean invert );

//1.4
void (__stdcall* glPointParameterf)( GLenum pname,GLfloat param );

//1.5
void (__stdcall* glGenBuffers)( GLsizei n,GLuint *buffers );
void (__stdcall* glDeleteBuffers)( GLsizei n,GLuint *buffers );
void (__stdcall* glBufferData)( GLenum target,GLsizei size,const GLvoid *data,GLenum usage );
void (__stdcall* glBufferSubData)( GLenum target,GLsizei offset,GLsizei size,const GLvoid *data );
void (__stdcall* glBindBuffer)( GLenum target,GLuint buffer );
int  (__stdcall* glIsBuffer)( GLuint buffer );
void (__stdcall* glGetBufferParameteriv)( GLenum target,GLenum pname,GLint *params );

void Init_GL_Exts(){
	
	const char *p=(const char*)glGetString( GL_VERSION );
	int v=(p[0]-'0')*10+(p[2]-'0');
	
	if( v>=13 ){
		(void*&)glActiveTexture=(void*)wglGetProcAddress( "glActiveTexture" );
		(void*&)glClientActiveTexture=(void*)wglGetProcAddress( "glClientActiveTexture" );
		(void*&)glCompressedTexImage2D=(void*)wglGetProcAddress( "glCompressedTexImage2D" );
		(void*&)glCompressedTexSubImage2D=(void*)wglGetProcAddress( "glCompressedTexSubImage2D" );
		(void*&)glMultiTexCoord4f=(void*)wglGetProcAddress( "glMultiTexCoord4f" );
		(void*&)glSampleCoverage=(void*)wglGetProcAddress( "glSampleCoverage" );
	}else{
		(void*&)glActiveTexture=(void*)wglGetProcAddress( "glActiveTextureARB" );
		(void*&)glClientActiveTexture=(void*)wglGetProcAddress( "glClientActiveTextureARB" );
		(void*&)glCompressedTexImage2D=(void*)wglGetProcAddress( "glCompressedTexImage2DARB" );
		(void*&)glCompressedTexSubImage2D=(void*)wglGetProcAddress( "glCompressedTexSubImage2DARB" );
		(void*&)glMultiTexCoord4f=(void*)wglGetProcAddress( "glMultiTexCoord4fARB" );
		(void*&)glSampleCoverage=(void*)wglGetProcAddress( "glSampleCoverageARB" );
	}
	if( v>=14 ){
		(void*&)glPointParameterf=(void*)wglGetProcAddress( "glPointParameterf" );
	}else{
		(void*&)glPointParameterf=(void*)wglGetProcAddress( "glPointParameterfARB" );
	}
	if( v>=15 ){
		(void*&)glGenBuffers=(void*)wglGetProcAddress( "glGenBuffers" );
		(void*&)glDeleteBuffers=(void*)wglGetProcAddress( "glDeleteBuffers" );
		(void*&)glBufferData=(void*)wglGetProcAddress( "glBufferData" );
		(void*&)glBufferSubData=(void*)wglGetProcAddress( "glBufferSubData" );
		(void*&)glBindBuffer=(void*)wglGetProcAddress( "glBindBuffer" );
		(void*&)glIsBuffer=(void*)wglGetProcAddress( "glIsBuffer" );
		(void*&)glGetBufferParameteriv=(void*)wglGetProcAddress( "glGetBufferParameteriv" );
	}else{
		(void*&)glGenBuffers=(void*)wglGetProcAddress( "glGenBuffersARB" );
		(void*&)glDeleteBuffers=(void*)wglGetProcAddress( "glDeleteBuffersARB" );
		(void*&)glBufferData=(void*)wglGetProcAddress( "glBufferDataARB" );
		(void*&)glBufferSubData=(void*)wglGetProcAddress( "glBufferSubDataARB" );
		(void*&)glBindBuffer=(void*)wglGetProcAddress( "glBindBufferARB" );
		(void*&)glIsBuffer=(void*)wglGetProcAddress( "glIsBufferARB" );
		(void*&)glGetBufferParameteriv=(void*)wglGetProcAddress( "glGetBufferParameterivARB" );
	}
}

#endif

BBDataBuffer *BBLoadImageData( BBDataBuffer *buf,String path,Array<int> info ){
	int width,height,depth;
	unsigned char *data=BBGlfwGame::GlfwGame()->LoadImageData( path,&width,&height,&depth );
	if( !data || depth<1 || depth>4 ) return 0;
	
	int size=width*height;
	
	if( !buf->_New( size*4 ) ) return 0;
	
	unsigned char *src=data,*dst=(unsigned char*)buf->WritePointer();
	int i;
	
	switch( depth ){
	case 1:for( i=0;i<size;++i ){ *dst++=*src;*dst++=*src;*dst++=*src++;*dst++=255; } break;
	case 2:for( i=0;i<size;++i ){ *dst++=*src;*dst++=*src;*dst++=*src++;*dst++=*src++; } break;
	case 3:for( i=0;i<size;++i ){ *dst++=*src++;*dst++=*src++;*dst++=*src++;*dst++=255; } break;
	case 4:for( i=0;i<size;++i ){ *dst++=*src++;*dst++=*src++;*dst++=*src++;*dst++=*src++; } break;
	}
	
	if( info.Length()>0 ) info[0]=width;
	if( info.Length()>1 ) info[1]=height;
	
	free( data );
	
	return buf;
}

void _glGenBuffers( int n,Array<int> buffers,int offset ){
	glGenBuffers( n,(GLuint*)&buffers[offset] );
}

void _glDeleteBuffers( int n,Array<int> buffers,int offset ){
	glDeleteBuffers( n,(GLuint*)&buffers[offset] );
}

void _glGenTextures( int n,Array<int> textures,int offset ){
	glGenTextures( n,(GLuint*)&textures[offset] );
}

void _glDeleteTextures( int n,Array<int> textures,int offset ){
	glDeleteTextures( n,(GLuint*)&textures[offset] );
}

void _glClipPlanef( int plane,Array<Float> equation,int offset ){
	double buf[4];
	for( int i=0;i<4;++i ) buf[i]=equation[offset+i];
	glClipPlane( plane,buf );
}

void _glGetClipPlanef( int plane,Array<Float> equation,int offset ){
	double buf[4];
	glGetClipPlane( plane,buf );
	for( int i=0;i<4;++i ) equation[offset+i]=buf[i];
}

void _glFogfv( int pname,Array<Float> params,int offset ){
	glFogfv( pname,&params[offset] );
}

void _glGetFloatv( int pname,Array<Float> params,int offset ){
	glGetFloatv( pname,&params[offset] );
}

void _glGetLightfv( int target,int pname,Array<Float> params,int offset ){
	glGetLightfv( target,pname,&params[offset] );
}

void _glGetMaterialfv( int target,int pname,Array<Float> params,int offset ){
	glGetMaterialfv( target,pname,&params[offset] );
}

void _glGetTexEnvfv( int target,int pname,Array<Float> params,int offset ){
	glGetTexEnvfv( target,pname,&params[offset] );
}

void _glGetTexParameterfv( int target,int pname,Array<Float> params,int offset ){
	glGetTexParameterfv( target,pname,&params[offset] );
}

void _glLightfv( int target,int pname,Array<Float> params,int offset ){
	glLightfv( target,pname,&params[offset] );
}

void _glLightModelfv( int pname,Array<Float> params,int offset ){
	glLightModelfv( pname,&params[offset] );
}

void _glLoadMatrixf( Array<Float> params,int offset ){
	glLoadMatrixf( &params[offset] );
}

void _glMaterialfv( int target,int pname,Array<Float> params,int offset ){
	glMaterialfv( target,pname,&params[offset] );
}

void _glMultMatrixf( Array<Float> params,int offset ){
	glMultMatrixf( &params[offset] );
}

void _glTexEnvfv( int target,int pname,Array<Float> params,int offset ){
	glTexEnvfv( target,pname,&params[offset] );
}

void _glTexParameterfv( int target,int pname,Array<Float> params,int offset ){
	glTexParameterfv( target,pname,&params[offset] );
}

void _glGetIntegerv( int pname,Array<int> params,int offset ){
	glGetIntegerv( pname,&params[offset] );
}

String _glGetString( int name ){
	return String( glGetString( name ) );
}

void _glGetTexEnviv( int target,int pname,Array<int> params,int offset ){
	glGetTexEnviv( target,pname,&params[offset] );
}

void _glGetTexParameteriv( int target,int pname,Array<int> params,int offset ){
	glGetTexParameteriv( target,pname,&params[offset] );
}

void _glTexEnviv( int target,int pname,Array<int> params,int offset ){
	glTexEnviv( target,pname,&params[offset] );
}

void _glTexParameteriv( int target,int pname,Array<int> params,int offset ){
	glTexParameteriv( target,pname,&params[offset] );
}

void _glVertexPointer( int size,int type,int stride,BBDataBuffer *pointer ){
	glVertexPointer( size,type,stride,pointer->ReadPointer() );
}

void _glVertexPointer( int size,int type,int stride,int offset ){
	glVertexPointer( size,type,stride,(const void*)offset );
}

void _glColorPointer( int size,int type,int stride,BBDataBuffer *pointer ){
	glColorPointer( size,type,stride,pointer->ReadPointer() );
}

void _glColorPointer( int size,int type,int stride,int offset ){
	glColorPointer( size,type,stride,(const void*)offset );
}

void _glNormalPointer( int type,int stride,BBDataBuffer *pointer ){
	glNormalPointer( type,stride,pointer->ReadPointer() );
}

void _glNormalPointer( int type,int stride,int offset ){
	glNormalPointer( type,stride,(const void*)offset );
}

void _glTexCoordPointer( int size,int type,int stride,BBDataBuffer *pointer ){
	glTexCoordPointer( size,type,stride,pointer->ReadPointer() );
}

void _glTexCoordPointer( int size,int type,int stride,int offset ){
	glTexCoordPointer( size,type,stride,(const void*)offset );
}

void _glDrawElements( int mode,int count,int type,BBDataBuffer *indices ){
	glDrawElements( mode,count,type,indices->ReadPointer() );
}

void _glDrawElements( int mode,int count,int type,int offset ){
	glDrawElements( mode,count,type,(const GLvoid*)offset );
}

void _glGetBufferParameteriv( int target,int pname,Array<int> params,int offset ){
	glGetBufferParameteriv( target,pname,&params[offset] );
}

void _glBufferData( int target,int size,BBDataBuffer *data,int usage ){
	glBufferData( target,size,data->ReadPointer(),usage );
}

void _glBufferSubData( int target,int offset,int size,BBDataBuffer *data ){
	glBufferSubData( target,offset,size,data->ReadPointer() );
}

void _glTexImage2D( int target,int level,int internalformat,int width,int height,int border,int format,int type,BBDataBuffer *pixels ){
	glTexImage2D( target,level,internalformat,width,height,border,format,type,pixels->ReadPointer() );
}

void _glTexSubImage2D( int target,int level,int xoffset,int yoffset,int width,int height,int format,int type,BBDataBuffer *pixels ){
	glTexSubImage2D( target,level,xoffset,yoffset,width,height,format,type,pixels->ReadPointer() );
}

void _glCompressedTexImage2D( int target,int level,int internalformat,int width,int height,int border,int imageSize,BBDataBuffer *pixels ){
	glCompressedTexImage2D( target,level,internalformat,width,height,border,imageSize,pixels->ReadPointer() );
}

void _glCompressedTexSubImage2D( int target,int level,int xoffset,int yoffset,int width,int height,int format,int imageSize,BBDataBuffer *pixels ){
	glCompressedTexSubImage2D( target,level,xoffset,yoffset,width,height,format,imageSize,pixels->ReadPointer() );
}

void _glReadPixels( int x,int y,int width,int height,int format,int type,BBDataBuffer *pixels ){
	glReadPixels( x,y,width,height,format,type,pixels->WritePointer() );
}

void _glFrustumf( float left,float right,float bottom,float top,float nearVal,float farVal ){
	glFrustum( left,right,bottom,top,nearVal,farVal );
}

void _glOrthof( float left,float right,float bottom,float top,float nearVal,float farVal ){
	glOrtho( left,right,bottom,top,nearVal,farVal );
}

void _glClearDepthf( float depth  ){
	glClearDepth( depth );
}

void _glDepthRangef( float nearVal,float farVal ){
	glDepthRange( nearVal,farVal );
}


#if !WINDOWS_8

// ***** socket.h *****

#if WINDOWS_PHONE_8

#include <Winsock2.h>

typedef int socklen_t;

#elif _WIN32

#include <winsock.h>

typedef int socklen_t;

#else

#include <netdb.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <arpa/inet.h>
#include <netinet/tcp.h>

#define closesocket close
#define ioctlsocket ioctl

#endif

class BBSocketAddress : public Object{
public:
	sockaddr_in _sa;
	
	BBSocketAddress();
	
	void Set( String host,int port );
	void Set( BBSocketAddress *address );
	void Set( const sockaddr_in &sa );
	
	String Host(){ Validate();return _host; }
	int Port(){ Validate();return _port; }
	
private:
	bool _valid;
	String _host;
	int _port;
	
	void Validate();
};

class BBSocket : public Object{
public:
	enum{
		PROTOCOL_CLIENT=1,
		PROTOCOL_SERVER=2,
		PROTOCOL_DATAGRAM=3
	};
	
	BBSocket();
	BBSocket( int sock );
	~BBSocket();
	
	bool Open( int protocol );
	void Close();
	
	bool Bind( String host,int port );
	bool Connect( String host,int port );
	bool Listen( int backlog );
	bool Accept();
	BBSocket *Accepted();

	int Send( BBDataBuffer *data,int offset,int count );
	int Receive( BBDataBuffer *data,int offset,int count );

	int SendTo( BBDataBuffer *data,int offset,int count,BBSocketAddress *address );
	int ReceiveFrom( BBDataBuffer *data,int offset,int count,BBSocketAddress *address );
	
	void GetLocalAddress( BBSocketAddress *address );
	void GetRemoteAddress( BBSocketAddress *address );
	
	static void InitSockets();
	
protected:
	int _sock;
	int _proto;
	int _accepted;
};

// ***** socket.cpp *****

static void setsockaddr( sockaddr_in *sa,String host,int port ){
	memset( sa,0,sizeof(*sa) );
	sa->sin_family=AF_INET;
	sa->sin_port=htons( port );
	sa->sin_addr.s_addr=htonl( INADDR_ANY );
	
	if( host.Length() && host.Length()<1024 ){
		char buf[1024];
		for( int i=0;i<host.Length();++i ) buf[i]=host[i];
		buf[host.Length()]=0;
		if( hostent *host=gethostbyname( buf ) ){
			if( char *hostip=inet_ntoa(*(in_addr *)*host->h_addr_list) ){
				sa->sin_addr.s_addr=inet_addr( hostip );
			}
		}
	}
}

void BBSocket::InitSockets(){
#if _WIN32
	static bool started;
	if( !started ){
		WSADATA ws;
		WSAStartup( 0x101,&ws );
		started=true;
	}
#endif
}

BBSocketAddress::BBSocketAddress():_valid( false ){
	BBSocket::InitSockets();
	memset( &_sa,0,sizeof(_sa) );
	_sa.sin_family=AF_INET;
}

void BBSocketAddress::Set( String host,int port ){
	setsockaddr( &_sa,host,port );
	_valid=false;
}

void BBSocketAddress::Set( BBSocketAddress *address ){
	_sa=address->_sa;
	_valid=false;
}

void BBSocketAddress::Set( const sockaddr_in &sa ){
	_sa=sa;
	_valid=false;
}

void BBSocketAddress::Validate(){
	if( _valid ) return;
	_host=String( int(_sa.sin_addr.s_addr)&0xff )+"."+String( int(_sa.sin_addr.s_addr>>8)&0xff )+"."+String( int(_sa.sin_addr.s_addr>>16)&0xff )+"."+String( int(_sa.sin_addr.s_addr>>24)&0xff );
	_port=htons( _sa.sin_port );
	_valid=true;
}

BBSocket::BBSocket():_sock( -1 ){
	BBSocket::InitSockets();
}

BBSocket::BBSocket( int sock ):_sock( sock ){
}

BBSocket::~BBSocket(){

	if( _sock>=0 ) closesocket( _sock );
}

bool BBSocket::Open( int proto ){

	if( _sock>=0 ) return false;
	
	switch( proto ){
	case PROTOCOL_CLIENT:
	case PROTOCOL_SERVER:
		_sock=socket( AF_INET,SOCK_STREAM,IPPROTO_TCP );
		if( _sock>=0 ){
			//nodelay
			int nodelay=1;
			setsockopt( _sock,IPPROTO_TCP,TCP_NODELAY,(const char*)&nodelay,sizeof(nodelay) );
	
			//Do this on Mac so server ports can be quickly reused...
			#if __APPLE__
			int flag=1;
			setsockopt( _sock,SOL_SOCKET,SO_REUSEADDR,&flag,sizeof(flag) );
			#endif
		}
		break;
	case PROTOCOL_DATAGRAM:
		_sock=socket( AF_INET,SOCK_DGRAM,IPPROTO_UDP );
		break;
	}
	
	if( _sock<0 ) return false;
	
	_proto=proto;
	return true;
}

void BBSocket::Close(){
	if( _sock<0 ) return;
	closesocket( _sock );
	_sock=-1;
}

void BBSocket::GetLocalAddress( BBSocketAddress *address ){
	sockaddr_in sa;
	memset( &sa,0,sizeof(sa) );
	sa.sin_family=AF_INET;
	socklen_t size=sizeof(sa);
	if( _sock>=0 ) getsockname( _sock,(sockaddr*)&sa,&size );
	address->Set( sa );
}

void BBSocket::GetRemoteAddress( BBSocketAddress *address ){
	sockaddr_in sa;
	memset( &sa,0,sizeof(sa) );
	sa.sin_family=AF_INET;
	socklen_t size=sizeof(sa);
	if( _sock>=0 ) getpeername( _sock,(sockaddr*)&sa,&size );
	address->Set( sa );
}

bool BBSocket::Bind( String host,int port ){

	sockaddr_in sa;
	setsockaddr( &sa,host,port );
	
	return bind( _sock,(sockaddr*)&sa,sizeof(sa) )>=0;
}

bool BBSocket::Connect( String host,int port ){

	sockaddr_in sa;
	setsockaddr( &sa,host,port );
	
	return connect( _sock,(sockaddr*)&sa,sizeof(sa) )>=0;
}

bool BBSocket::Listen( int backlog ){
	return listen( _sock,backlog )>=0;
}

bool BBSocket::Accept(){
	_accepted=accept( _sock,0,0 );
	return _accepted>=0;
}

BBSocket *BBSocket::Accepted(){
	if( _accepted>=0 ) return new BBSocket( _accepted );
	return 0;
}

int BBSocket::Send( BBDataBuffer *data,int offset,int count ){
	return send( _sock,(const char*)data->ReadPointer(offset),count,0 );
}

int BBSocket::Receive( BBDataBuffer *data,int offset,int count ){
	return recv( _sock,(char*)data->WritePointer( offset ),count,0 );
}

int BBSocket::SendTo( BBDataBuffer *data,int offset,int count,BBSocketAddress *address ){
	return sendto( _sock,(const char*)data->ReadPointer(offset),count,0,(sockaddr*)&address->_sa,sizeof(address->_sa) );
}

int BBSocket::ReceiveFrom( BBDataBuffer *data,int offset,int count,BBSocketAddress *address ){
	sockaddr_in sa;
	socklen_t size=sizeof(sa);
	memset( &sa,0,size );
	int n=recvfrom( _sock,(char*)data->WritePointer( offset ),count,0,(sockaddr*)&sa,&size );
	address->Set( sa );
	return n;
}

#endif


// The gloriously *MAD* winrt version!

#if WINDOWS_8

// ***** socket_winrt.h *****

#include <map>

using namespace Windows::Networking;
using namespace Windows::Networking::Sockets;
using namespace Windows::Storage::Streams;

class BBSocketAddress : public Object{
public:
	HostName ^hostname;
	Platform::String ^service;
	
	BBSocketAddress();

	void Set( BBSocketAddress *address );
	void Set( String host,int port );

	String Host();
	int Port();
	
	bool operator<( const BBSocketAddress &t )const;
};

class BBSocket : public Object{
public:

	enum{
		PROTOCOL_STREAM=1,
		PROTOCOL_SERVER=2,
		PROTOCOL_DATAGRAM=3
	};

	BBSocket();
	~BBSocket();
	
	bool Open( int protocol );
	bool Open( StreamSocket ^stream );
	void Close();
	
	bool Bind( String host,int port );
	bool Connect( String host,int port );
	bool Listen( int backlog );
	bool Accept();
	BBSocket *Accepted();

	int Send( BBDataBuffer *data,int offset,int count );
	int Receive( BBDataBuffer *data,int offset,int count );
	
	int SendTo( BBDataBuffer *data,int offset,int count,BBSocketAddress *address );
	int ReceiveFrom( BBDataBuffer *data,int offset,int count,BBSocketAddress *address );
	
	void GetLocalAddress( BBSocketAddress *address );
	void GetRemoteAddress( BBSocketAddress *address );

private:

	StreamSocket ^_stream;
	StreamSocketListener ^_server;
	DatagramSocket ^_datagram;
	
	HANDLE _revent;
	HANDLE _wevent;

	DataReader ^_reader;
	DataWriter ^_writer;
	
	AsyncOperationCompletedHandler<unsigned int> ^_recvhandler;
	AsyncOperationCompletedHandler<unsigned int> ^_sendhandler;
	AsyncOperationCompletedHandler<IOutputStream^> ^_getouthandler; 
	
	//for "server" sockets only
	StreamSocket ^_accepted;
	std::vector<StreamSocket^> _acceptQueue;
	int _acceptPut,_acceptGet;
	HANDLE _acceptSema;	

	//for "datagram" sockets only
	typedef DatagramSocketMessageReceivedEventArgs RecvArgs;
	std::vector<RecvArgs^> _recvQueue;
	int _recvPut,_recvGet;
	HANDLE _recvSema;
	
	//for "datagram" sendto
	std::map<BBSocketAddress,DataWriter^> _sendToMap;
	
	template<class X,class Y> struct Delegate{
		BBSocket *socket;
		void (BBSocket::*func)( X,Y );
		Delegate( BBSocket *socket,void (BBSocket::*func)( X,Y ) ):socket( socket ),func( func ){
		}
		void operator()( X x,Y y ){
			(socket->*func)( x,y );
		}
	};
	template<class X,class Y> friend struct Delegate;
	
	template<class X,class Y> Delegate<X,Y> MakeDelegate( void (BBSocket::*func)( X,Y ) ){
		return Delegate<X,Y>( this,func );
	}
	
	template<class X,class Y> TypedEventHandler<X,Y> ^CreateTypedEventHandler( void (BBSocket::*func)( X,Y ) ){
		return ref new TypedEventHandler<X,Y>( Delegate<X,Y>( this,func ) );
	}

	bool Wait( IAsyncAction ^action );
	
	void OnActionComplete( IAsyncAction ^action,AsyncStatus status );
	void OnSendComplete( IAsyncOperation<unsigned int> ^op,AsyncStatus status );
	void OnReceiveComplete( IAsyncOperation<unsigned int> ^op,AsyncStatus status );
	void OnConnectionReceived( StreamSocketListener ^listener,StreamSocketListenerConnectionReceivedEventArgs ^args );
	void OnMessageReceived( DatagramSocket ^socket,DatagramSocketMessageReceivedEventArgs ^args );
	void OnGetOutputStreamComplete( IAsyncOperation<IOutputStream^> ^op,AsyncStatus status );
};

// ***** socket_winrt.cpp *****

BBSocketAddress::BBSocketAddress():hostname( nullptr ),service( nullptr ){
}

void BBSocketAddress::Set( String host,int port ){
	HostName ^hostname=nullptr;
	if( host.Length() ) hostname=ref new HostName( host.ToWinRTString() );
	service=String( port ).ToWinRTString();
}

void BBSocketAddress::Set( BBSocketAddress *address ){
	hostname=address->hostname;
	service=address->service;
}

String BBSocketAddress::Host(){
	return hostname ? hostname->CanonicalName : "0.0.0.0";
}

int BBSocketAddress::Port(){
	return service ? String( service->Data(),service->Length() ).ToInt() : 0;
}

bool BBSocketAddress::operator<( const BBSocketAddress &t )const{
	if( hostname || t.hostname ){
		if( !hostname ) return true;
		if( !t.hostname ) return false;
		int n=HostName::Compare( hostname->CanonicalName,t.hostname->CanonicalName );
		if( n ) return n<0;
	}
	if( service || t.service ){
		if( !service ) return -1;
		if( !t.service ) return 1;
		int n=Platform::String::CompareOrdinal( service,t.service );
		if( n ) return n<0;
	}
	return false;
}

BBSocket::BBSocket(){

	_revent=CreateEventEx( 0,0,0,EVENT_ALL_ACCESS );
	_wevent=CreateEventEx( 0,0,0,EVENT_ALL_ACCESS );
	
	_recvSema=0;
	_acceptSema=0;
	
	_sendhandler=ref new AsyncOperationCompletedHandler<unsigned int>( MakeDelegate( &BBSocket::OnSendComplete ) );
	_recvhandler=ref new AsyncOperationCompletedHandler<unsigned int>( MakeDelegate( &BBSocket::OnReceiveComplete ) );
	_getouthandler=ref new AsyncOperationCompletedHandler<IOutputStream^>( MakeDelegate( &BBSocket::OnGetOutputStreamComplete ) );	
}

BBSocket::~BBSocket(){
	if( _revent ) CloseHandle( _revent );
	if( _wevent ) CloseHandle( _wevent );
	if( _recvSema ) CloseHandle( _recvSema );
	if( _acceptSema ) CloseHandle( _acceptSema );
}

void BBSocket::OnActionComplete( IAsyncAction ^action,AsyncStatus status ){
	SetEvent( _revent );
}

bool BBSocket::Wait( IAsyncAction ^action ){
	action->Completed=ref new AsyncActionCompletedHandler( MakeDelegate( &BBSocket::OnActionComplete ) );
	if( WaitForSingleObjectEx( _revent,INFINITE,FALSE )!=WAIT_OBJECT_0 ) return false;
	return action->Status==AsyncStatus::Completed;
}

bool BBSocket::Open( int protocol ){

	switch( protocol ){
	case PROTOCOL_STREAM:
		_stream=ref new StreamSocket();
		return true;
	case PROTOCOL_SERVER:
		_acceptGet=_acceptPut=0;
		_acceptQueue.resize( 256 );
		_acceptSema=CreateSemaphoreEx( 0,0,256,0,0,EVENT_ALL_ACCESS );
		_server=ref new StreamSocketListener();
		_server->ConnectionReceived+=CreateTypedEventHandler( &BBSocket::OnConnectionReceived );
		return true;
	case PROTOCOL_DATAGRAM:
		_recvGet=_recvPut=0;
		_recvQueue.resize( 256 );
		_recvSema=CreateSemaphoreEx( 0,0,256,0,0,EVENT_ALL_ACCESS );
		_datagram=ref new DatagramSocket();
		_datagram->MessageReceived+=CreateTypedEventHandler( &BBSocket::OnMessageReceived );
		return true;
	}

	return false;
}

bool BBSocket::Open( StreamSocket ^stream ){

	_stream=stream;
	
	_reader=ref new DataReader( _stream->InputStream );
	_reader->InputStreamOptions=InputStreamOptions::Partial;
	
	_writer=ref new DataWriter( _stream->OutputStream );
	
	return true;
}

void BBSocket::Close(){
	if( _stream ) delete _stream;
	if( _server ) delete _server;
	if( _datagram ) delete _datagram;
	_stream=nullptr;
	_server=nullptr;
	_datagram=nullptr;
}

bool BBSocket::Bind( String host,int port ){

	HostName ^hostname=nullptr;
	if( host.Length() ) hostname=ref new HostName( host.ToWinRTString() );
	auto service=(port ? String( port ) : String()).ToWinRTString();

	if( _stream ){
//		return Wait( _stream->BindEndpointAsync( hostname,service ) );
	}else if( _server ){
		return Wait( _server->BindEndpointAsync( hostname,service ) );
	}else if( _datagram ){
		return Wait( _datagram->BindEndpointAsync( hostname,service ) );
	}

	return false;
}

bool BBSocket::Listen( int backlog ){
	return _server!=nullptr;
}

bool BBSocket::Accept(){
	if( WaitForSingleObjectEx( _acceptSema,INFINITE,FALSE )!=WAIT_OBJECT_0 ) return false;
	_accepted=_acceptQueue[_acceptGet & 255];
	_acceptQueue[_acceptGet++ & 255]=nullptr;
	return true;
}

BBSocket *BBSocket::Accepted(){
	BBSocket *socket=new BBSocket();
	if( socket->Open( _accepted ) ) return socket;
	return 0;
}

void BBSocket::OnConnectionReceived( StreamSocketListener ^listener,StreamSocketListenerConnectionReceivedEventArgs ^args ){

	_acceptQueue[_acceptPut++ & 255]=args->Socket;
	ReleaseSemaphore( _acceptSema,1,0 );
}

void BBSocket::OnMessageReceived( DatagramSocket ^socket,DatagramSocketMessageReceivedEventArgs ^args ){

	_recvQueue[_recvPut++ & 255]=args;
	ReleaseSemaphore( _recvSema,1,0 );
}

bool BBSocket::Connect( String host,int port ){

	auto hostname=ref new HostName( host.ToWinRTString() );
	auto service=String( port ).ToWinRTString();

	if( _stream ){

		if( !Wait( _stream->ConnectAsync( hostname,service ) ) ) return false;
		
		_reader=ref new DataReader( _stream->InputStream );
		_reader->InputStreamOptions=InputStreamOptions::Partial;

		_writer=ref new DataWriter( _stream->OutputStream );
	
		return true;
		
	}else if( _datagram ) {
	
		if( !Wait( _datagram->ConnectAsync( hostname,service ) ) ) return false;
		
		_writer=ref new DataWriter( _datagram->OutputStream );
		
		return true;
	}
}

int BBSocket::Send( BBDataBuffer *data,int offset,int count ){

	if( !_writer ) return 0;

	const unsigned char *p=(const unsigned char*)data->ReadPointer( offset );
	
	_writer->WriteBytes( Platform::ArrayReference<uint8>( (uint8*)p,count ) );
	auto op=_writer->StoreAsync();
	op->Completed=_sendhandler;
	
	if( WaitForSingleObjectEx( _wevent,INFINITE,FALSE )!=WAIT_OBJECT_0 ) return 0;

//	if( op->Status!=AsyncStatus::Completed ) return 0;
	
	return count;
}

void BBSocket::OnSendComplete( IAsyncOperation<unsigned int> ^op,AsyncStatus status ){

	SetEvent( _wevent );
}

int BBSocket::Receive( BBDataBuffer *data,int offset,int count ){

	if( _stream ){
	
		auto op=_reader->LoadAsync( count );
		op->Completed=_recvhandler;
	
		if( WaitForSingleObjectEx( _revent,INFINITE,FALSE )!=WAIT_OBJECT_0 ) return 0;
		
	//	if( op->Status!=AsyncStatus::Completed ) return 0;
		
		int n=_reader->UnconsumedBufferLength;
			
		_reader->ReadBytes( Platform::ArrayReference<uint8>( (uint8*)data->WritePointer( offset ),n ) );
	
		return n;
		
	}else if( _datagram ){

		if( WaitForSingleObjectEx( _recvSema,INFINITE,FALSE )!=WAIT_OBJECT_0 ) return 0;
		
		auto recvArgs=_recvQueue[_recvGet & 255];
		_recvQueue[_recvGet++ & 255]=nullptr;
		
		auto reader=recvArgs->GetDataReader();
		int n=reader->UnconsumedBufferLength;
		if( n>count ) n=count;

		reader->ReadBytes( Platform::ArrayReference<uint8>( (uint8*)data->WritePointer( offset ),n ) );
		
		return n;
	}
	return 0;
}

void BBSocket::OnReceiveComplete( IAsyncOperation<unsigned int> ^op,AsyncStatus status ){

	SetEvent( _revent );
}

int BBSocket::SendTo( BBDataBuffer *data,int offset,int count,BBSocketAddress *address ){

	auto it=_sendToMap.find( *address );
	
	if( it==_sendToMap.end() ){
	
		auto op=_datagram->GetOutputStreamAsync( address->hostname,address->service );
		op->Completed=_getouthandler;
		
		if( WaitForSingleObjectEx( _wevent,INFINITE,FALSE )!=WAIT_OBJECT_0 || op->Status!=AsyncStatus::Completed ){
			bbPrint( "GetOutputStream failed" );
			return 0;
		}	
		it=_sendToMap.insert( std::make_pair( *address,ref new DataWriter( op->GetResults() ) ) ).first;
	}

	auto writer=it->second;

	writer->WriteBytes( Platform::ArrayReference<uint8>( (uint8*)data->ReadPointer( offset ),count ) );
	auto op=writer->StoreAsync();
	op->Completed=_sendhandler;
	
	if( WaitForSingleObjectEx( _wevent,INFINITE,FALSE )!=WAIT_OBJECT_0 ) return 0;

//	if( op->Status!=AsyncStatus::Completed ) return 0;
	
	return count;
}

void BBSocket::OnGetOutputStreamComplete( IAsyncOperation<IOutputStream^> ^op,AsyncStatus status ){

	SetEvent( _wevent );
}

int BBSocket::ReceiveFrom( BBDataBuffer *data,int offset,int count,BBSocketAddress *address ){

	if( !_datagram ) return 0;
	
	if( WaitForSingleObjectEx( _recvSema,INFINITE,FALSE )!=WAIT_OBJECT_0 ) return 0;
	
	auto recvArgs=_recvQueue[_recvGet & 255];
	_recvQueue[_recvGet++ & 255]=nullptr;
	
	auto reader=recvArgs->GetDataReader();
	int n=reader->UnconsumedBufferLength;
	if( n>count ) n=count;

	reader->ReadBytes( Platform::ArrayReference<uint8>( (uint8*)data->WritePointer( offset ),n ) );

	address->hostname=recvArgs->RemoteAddress;
	address->service=recvArgs->RemotePort;
	
	return n;
}
	
void BBSocket::GetLocalAddress( BBSocketAddress *address ){
	if( _stream ){
		address->hostname=_stream->Information->LocalAddress;
		address->service=_stream->Information->LocalPort;
	}else if( _server ){
		address->hostname=nullptr;
		address->service=_server->Information->LocalPort;
	}else if( _datagram ){
		address->hostname=_datagram->Information->LocalAddress;
		address->service=_datagram->Information->LocalPort;
	}
}

void BBSocket::GetRemoteAddress( BBSocketAddress *address ){
	if( _stream ){
		address->hostname=_stream->Information->RemoteAddress;
		address->service=_stream->Information->RemotePort;
	}else if( _server ){
		address->hostname=nullptr;
		address->service=nullptr;
	}else if( _datagram ){
		address->hostname=_datagram->Information->RemoteAddress;
		address->service=_datagram->Information->RemotePort;
	}
}

#endif

class c_App;
class c_MiniB3DApp;
class c_Game;
class c_GameDelegate;
class c_Image;
class c_GraphicsContext;
class c_Frame;
class c_InputDevice;
class c_JoyState;
class c_DisplayMode;
class c_Map;
class c_IntMap;
class c_Stack;
class c_Node;
class c_BBGameEvent;
class c_TRender;
class c_OpenglES11;
class c_MojoEmulationDevice;
class c_QuadCache;
class c_TEntity;
class c_TMesh;
class c_Matrix;
class c_Vector;
class c_TCollision;
class c_List;
class c_EntityList;
class c_Node2;
class c_HeadNode;
class c_TBrush;
class c_TTexture;
class c_TSurface;
class c_List2;
class c_Node3;
class c_HeadNode2;
class c_TColTree;
class c_MojoSurface;
class c_List3;
class c_Node4;
class c_HeadNode3;
class c_TPixmap;
class c_TPixmapPreloader;
class c_IPreloadManager;
class c_PixmapStack;
class c_Stack2;
class c_Enumerator;
class c_BackwardsStack;
class c_BackwardsEnumerator;
class c_List4;
class c_StringList;
class c_Node5;
class c_HeadNode4;
class c_Enumerator2;
class c_Stack3;
class c_TextureStack;
class c_Enumerator3;
class c_Node6;
class c_TCamera;
class c_List5;
class c_EntityList2;
class c_Node7;
class c_HeadNode5;
class c_Enumerator4;
class c_TShader;
class c_List6;
class c_Node8;
class c_HeadNode6;
class c_Enumerator5;
class c_IShaderProcess;
class c_IShaderRender;
class c_TLight;
class c_List7;
class c_Node9;
class c_HeadNode7;
class c_Enumerator6;
class c_RenderAlphaList;
class c_Enumerator7;
class c_Enumerator8;
class c_VertexDataBuffer;
class c_DataBuffer;
class c_IRenderUpdate;
class c_Enumerator9;
class c_IShader2D;
class c_BlankShader;
class c_ShortBuffer;
class c_TSprite;
class c_CalLoaderHandler;
class c_IOnHttpRequestComplete;
class c_CalLoadingCallback;
class c_List8;
class c_Node10;
class c_HeadNode8;
class c_CalLoader;
class c_SKNCalSkeletonLoader;
class c_IOnConnectComplete;
class c_IOnSendComplete;
class c_IOnReceiveComplete;
class c_HttpRequest;
class c_Url;
class c_Stack4;
class c_StringStack;
class c_IAsyncEventSource;
class c_Socket;
class c_Thread;
class c_AsyncQueue;
class c_Stack5;
class c_Enumerator10;
class c_Stack6;
class c_AsyncOp;
class c_AsyncConnectOp;
class c_SKNCalMeshLoader;
class c_SKNCalAnimationLoader;
class c_SKNCalImageLoader;
class c_Cal3dB3d;
class c_Cal3dB3dMesh;
class c_List9;
class c_Node11;
class c_HeadNode9;
class c_CalCoreAnimation;
class c_List10;
class c_Node12;
class c_HeadNode10;
class c_CalCoreModel;
class c_CalCoreSkeleton;
class c_CalCoreMorphAnimation;
class c_CalCoreMesh;
class c_CalCoreMaterial;
class c_Map2;
class c_IntMap2;
class c_Map3;
class c_IntMap3;
class c_Map4;
class c_StringMap;
class c_DeltaTimer;
class c_TBone;
class c_Line;
class c_TText;
class c_IPixmapManager;
class c_TTextureFilter;
class c_List11;
class c_Node13;
class c_HeadNode11;
class c_Enumerator11;
class c_List12;
class c_HeadNode12;
class c_Enumerator12;
class c_Enumerator13;
class c_CalCoreBone;
class c_Node14;
class c_CalQuaternion;
class c_CalVector;
class c_CalBoundingBox;
class c_CalPlane;
class c_CalVertex;
class c_CalCoreSubmesh;
class c_CalSpring;
class c_CalInfluence;
class c_CalModel;
class c_CalSkeleton;
class c_CalAbstractMixer;
class c_CalMixer;
class c_CalAnimation;
class c_CalAnimationAction;
class c_CalAnimationCycle;
class c_CalMorphTargetMixer;
class c_CalPhysique;
class c_CalSpringSystem;
class c_CalRenderer;
class c_CalSubmesh;
class c_CalMesh;
class c_CalBone;
class c_CalMatrix;
class c_Enumerator14;
class c_CalTangentSpace;
class c_CalFace;
class c_CalPhysicalProperty;
class c_CalCoreSubMorphTarget;
class c_CalBlendVertex;
class c_NormHelperClass;
class c_Map5;
class c_NormMap;
class c_Node15;
class c_CalCoreTrack;
class c_CalCoreKeyframe;
class c_CalCallbackRecord;
class c_CalAnimationType;
class c_CalAnimationState;
class c_CalAnimationCallback;
class c_CalTextureCoordinate;
class c_CalImage;
class c_EffectState;
class c_SurfaceAlphaList;
class c_FloatBuffer;
class c_TVertexAnim;
class c_TPixmapGL;
class c_PreloadGL;
class c_XMLError;
class c_XMLNode;
class c_XMLDoc;
class c_XMLStringBuffer;
class c_List13;
class c_Node16;
class c_HeadNode13;
class c_Map6;
class c_StringMap2;
class c_Node17;
class c_XMLAttributeQuery;
class c_XMLAttributeQueryItem;
class c_XMLAttribute;
class c_Map7;
class c_StringMap3;
class c_Node18;
class c_Enumerator15;
class c_PreloadData;
class c_ArrayIntMap;
class c_AsyncSocketIoOp;
class c_AsyncSendOp;
class c_AsyncReceiveOp;
class c_App : public Object{
	public:
	c_App();
	c_App* m_new();
	int p_OnResize();
	virtual int p_OnCreate();
	int p_OnSuspend();
	virtual int p_OnResume();
	virtual int p_OnUpdate();
	int p_OnLoading();
	virtual int p_OnRender();
	int p_OnClose();
	int p_OnBack();
	void mark();
	String debug();
};
String dbg_type(c_App**p){return "App";}
class c_MiniB3DApp : public c_App{
	public:
	c_StringList* m_preload_list;
	int m_init;
	int m_old_ms;
	int m_renders;
	int m_fps;
	c_MiniB3DApp();
	c_MiniB3DApp* m_new();
	int p_PreLoad(String);
	int p_PreLoad2(Array<String >);
	int p_Create();
	virtual int p_Init();
	void p_Minib3dInit();
	int p_OnCreate();
	virtual int p_Update();
	int p_OnUpdate();
	int p_PreLoadRender();
	static bool m__resumed;
	virtual int p_Render();
	int p_OnRender();
	static bool m__suspend;
	int p_Resume();
	int p_OnResume();
	void mark();
	String debug();
};
String dbg_type(c_MiniB3DApp**p){return "MiniB3DApp";}
class c_Game : public c_MiniB3DApp{
	public:
	c_CalLoaderHandler* m_hndlr;
	c_Cal3dB3d* m_CB3D;
	c_DeltaTimer* m_dt;
	c_TCamera* m_cam;
	c_TLight* m_light;
	c_TMesh* m_mesh;
	c_TText* m_txt;
	bool m_init_gl;
	c_TTexture* m_TestTexture;
	c_CalImage* m_Cimg;
	int m_touchBegin;
	int m_oldTouchX;
	int m_oldTouchY;
	Float m_lr;
	Float m_ud;
	c_Game();
	c_Game* m_new();
	int p_OnCreate();
	int p_Init();
	int p_Update();
	int p_Render();
	void mark();
	String debug();
};
String dbg_type(c_Game**p){return "Game";}
extern c_App* bb_app2__app;
class c_GameDelegate : public BBGameDelegate{
	public:
	gxtkGraphics* m__graphics;
	gxtkAudio* m__audio;
	c_InputDevice* m__input;
	c_GameDelegate();
	c_GameDelegate* m_new();
	void StartGame();
	void SuspendGame();
	void ResumeGame();
	void UpdateGame();
	void RenderGame();
	void KeyEvent(int,int);
	void MouseEvent(int,int,Float,Float);
	void TouchEvent(int,int,Float,Float);
	void MotionEvent(int,int,Float,Float,Float);
	void DiscardGraphics();
	void mark();
	String debug();
};
String dbg_type(c_GameDelegate**p){return "GameDelegate";}
extern c_GameDelegate* bb_app2__delegate;
extern BBGame* bb_app2__game;
int bbMain();
extern gxtkGraphics* bb_graphics_device;
int bb_graphics_SetGraphicsDevice(gxtkGraphics*);
class c_Image : public Object{
	public:
	gxtkSurface* m_surface;
	int m_width;
	int m_height;
	Array<c_Frame* > m_frames;
	int m_flags;
	Float m_tx;
	Float m_ty;
	c_Image* m_source;
	c_Image();
	static int m_DefaultFlags;
	c_Image* m_new();
	int p_SetHandle(Float,Float);
	int p_ApplyFlags(int);
	c_Image* p_Init2(gxtkSurface*,int,int);
	c_Image* p_Init3(gxtkSurface*,int,int,int,int,int,int,c_Image*,int,int,int,int);
	int p_Width();
	void mark();
	String debug();
};
String dbg_type(c_Image**p){return "Image";}
class c_GraphicsContext : public Object{
	public:
	c_Image* m_defaultFont;
	c_Image* m_font;
	int m_firstChar;
	int m_matrixSp;
	Float m_ix;
	Float m_iy;
	Float m_jx;
	Float m_jy;
	Float m_tx;
	Float m_ty;
	int m_tformed;
	int m_matDirty;
	Float m_color_r;
	Float m_color_g;
	Float m_color_b;
	Float m_alpha;
	int m_blend;
	Float m_scissor_x;
	Float m_scissor_y;
	Float m_scissor_width;
	Float m_scissor_height;
	c_GraphicsContext();
	c_GraphicsContext* m_new();
	void mark();
	String debug();
};
String dbg_type(c_GraphicsContext**p){return "GraphicsContext";}
extern c_GraphicsContext* bb_graphics_context;
String bb_data_FixDataPath(String);
class c_Frame : public Object{
	public:
	int m_x;
	int m_y;
	c_Frame();
	c_Frame* m_new(int,int);
	c_Frame* m_new2();
	void mark();
	String debug();
};
String dbg_type(c_Frame**p){return "Frame";}
c_Image* bb_graphics_LoadImage(String,int,int);
c_Image* bb_graphics_LoadImage2(String,int,int,int,int);
int bb_graphics_SetFont(c_Image*,int);
extern gxtkAudio* bb_audio_device;
int bb_audio_SetAudioDevice(gxtkAudio*);
class c_InputDevice : public Object{
	public:
	Array<c_JoyState* > m__joyStates;
	Array<bool > m__keyDown;
	int m__keyHitPut;
	Array<int > m__keyHitQueue;
	Array<int > m__keyHit;
	int m__charGet;
	int m__charPut;
	Array<int > m__charQueue;
	Float m__mouseX;
	Float m__mouseY;
	Array<Float > m__touchX;
	Array<Float > m__touchY;
	Float m__accelX;
	Float m__accelY;
	Float m__accelZ;
	c_InputDevice();
	c_InputDevice* m_new();
	void p_PutKeyHit(int);
	void p_BeginUpdate();
	void p_EndUpdate();
	void p_KeyEvent(int,int);
	void p_MouseEvent(int,int,Float,Float);
	void p_TouchEvent(int,int,Float,Float);
	void p_MotionEvent(int,int,Float,Float,Float);
	int p_KeyHit(int);
	bool p_KeyDown(int);
	Float p_TouchX(int);
	Float p_TouchY(int);
	void mark();
	String debug();
};
String dbg_type(c_InputDevice**p){return "InputDevice";}
class c_JoyState : public Object{
	public:
	Array<Float > m_joyx;
	Array<Float > m_joyy;
	Array<Float > m_joyz;
	Array<bool > m_buttons;
	c_JoyState();
	c_JoyState* m_new();
	void mark();
	String debug();
};
String dbg_type(c_JoyState**p){return "JoyState";}
extern c_InputDevice* bb_input_device;
int bb_input_SetInputDevice(c_InputDevice*);
extern int bb_app2__devWidth;
extern int bb_app2__devHeight;
void bb_app2_ValidateDeviceWindow(bool);
class c_DisplayMode : public Object{
	public:
	int m__width;
	int m__height;
	c_DisplayMode();
	c_DisplayMode* m_new(int,int);
	c_DisplayMode* m_new2();
	void mark();
	String debug();
};
String dbg_type(c_DisplayMode**p){return "DisplayMode";}
class c_Map : public Object{
	public:
	c_Node* m_root;
	c_Map();
	c_Map* m_new();
	virtual int p_Compare(int,int)=0;
	c_Node* p_FindNode(int);
	bool p_Contains(int);
	int p_RotateLeft(c_Node*);
	int p_RotateRight(c_Node*);
	int p_InsertFixup(c_Node*);
	bool p_Set(int,c_DisplayMode*);
	bool p_Insert(int,c_DisplayMode*);
	void mark();
	String debug();
};
String dbg_type(c_Map**p){return "Map";}
class c_IntMap : public c_Map{
	public:
	c_IntMap();
	c_IntMap* m_new();
	int p_Compare(int,int);
	void mark();
	String debug();
};
String dbg_type(c_IntMap**p){return "IntMap";}
class c_Stack : public Object{
	public:
	Array<c_DisplayMode* > m_data;
	int m_length;
	c_Stack();
	c_Stack* m_new();
	c_Stack* m_new2(Array<c_DisplayMode* >);
	void p_Push(c_DisplayMode*);
	void p_Push2(Array<c_DisplayMode* >,int,int);
	void p_Push3(Array<c_DisplayMode* >,int);
	Array<c_DisplayMode* > p_ToArray();
	void mark();
	String debug();
};
String dbg_type(c_Stack**p){return "Stack";}
class c_Node : public Object{
	public:
	int m_key;
	c_Node* m_right;
	c_Node* m_left;
	c_DisplayMode* m_value;
	int m_color;
	c_Node* m_parent;
	c_Node();
	c_Node* m_new(int,c_DisplayMode*,int,c_Node*);
	c_Node* m_new2();
	void mark();
	String debug();
};
String dbg_type(c_Node**p){return "Node";}
extern Array<c_DisplayMode* > bb_app2__displayModes;
extern c_DisplayMode* bb_app2__desktopMode;
int bb_app2_DeviceWidth();
int bb_app2_DeviceHeight();
void bb_app2_EnumDisplayModes();
extern gxtkGraphics* bb_graphics_renderDevice;
int bb_graphics_SetMatrix(Float,Float,Float,Float,Float,Float);
int bb_graphics_SetMatrix2(Array<Float >);
int bb_graphics_SetColor(Float,Float,Float);
int bb_graphics_SetAlpha(Float);
int bb_graphics_SetBlend(int);
int bb_graphics_SetScissor(Float,Float,Float,Float);
int bb_graphics_BeginRender();
int bb_graphics_EndRender();
class c_BBGameEvent : public Object{
	public:
	c_BBGameEvent();
	void mark();
	String debug();
};
String dbg_type(c_BBGameEvent**p){return "BBGameEvent";}
void bb_app2_EndApp();
extern int bb_app2__updateRate;
void bb_app2_SetUpdateRate(int);
class c_TRender : public Object{
	public:
	c_TRender();
	c_TRender* m_new();
	static c_TRender* m_render;
	virtual int p_GraphicsInit(int)=0;
	static c_List3* m_draw_list;
	static int m_tris_rendered;
	virtual bool p_ContextReady()=0;
	virtual int p_DeleteTexture(c_TTexture*)=0;
	virtual c_TTexture* p_BindTexture(c_TTexture*,int)=0;
	int p_BindTextureStack();
	virtual void p_Reset()=0;
	virtual int p_UpdateCamera(c_TCamera*)=0;
	virtual int p_UpdateLight(c_TCamera*,c_TLight*)=0;
	static c_RenderAlphaList* m_render_list;
	static c_RenderAlphaList* m_render_alpha_list;
	static int m_wireframe;
	virtual void p_Render2(c_TEntity*,c_TCamera*)=0;
	virtual void p_Finish()=0;
	void p_RenderCamera(c_TCamera*,int);
	static c_TShader* m_temp_shader;
	static c_IShader2D* m_shader2D;
	static int m_alpha_pass;
	static c_TCamera* m_camera2D;
	static int m_width;
	static int m_height;
	static void m_RenderDrawList();
	void p_RenderWorldFinish();
	static void m_RenderWorld();
	static bool m_vbo_enabled;
	virtual int p_UpdateVBO(c_TSurface*)=0;
	static int m_MAX_TEXTURES;
	virtual Float p_GetVersion()=0;
	virtual int p_ClearErrors();
	virtual int p_DisableLight(c_TLight*)=0;
	void mark();
	String debug();
};
String dbg_type(c_TRender**p){return "TRender";}
class c_OpenglES11 : public c_TRender{
	public:
	c_EffectState* m_last_effect;
	c_EffectState* m_effect;
	c_DataBuffer* m_slice_pos;
	c_DataBuffer* m_slice_norm;
	c_DataBuffer* m_slice_color;
	Array<Float > m_t_array;
	c_OpenglES11();
	c_OpenglES11* m_new();
	bool p_ContextReady();
	static c_TTexture* m_last_texture;
	static c_TSurface* m_last_sprite;
	static int m_last_tex_count;
	static bool m__useMojo;
	void p_Reset();
	static c_SurfaceAlphaList* m_alpha_list;
	static int m_count1280error;
	static int m_GetGLError();
	int p_UpdateVBO(c_TSurface*);
	void p_Render2(c_TEntity*,c_TCamera*);
	void p_Finish();
	static bool m_opengl_es;
	Float p_GetVersion();
	void p_EnableStates();
	int p_EnableHardwareInfo();
	int p_GraphicsInit(int);
	int p_DeleteTexture(c_TTexture*);
	c_TTexture* p_BindTexture(c_TTexture*,int);
	static Array<int > m_gl_light;
	int p_DisableLight(c_TLight*);
	static int m_light_no;
	static int m_old_no_lights;
	int p_UpdateLight(c_TCamera*,c_TLight*);
	int p_UpdateCamera(c_TCamera*);
	int p_ClearErrors();
	void mark();
	String debug();
};
String dbg_type(c_OpenglES11**p){return "OpenglES11";}
class c_MojoEmulationDevice : public gxtkGraphics{
	public:
	c_TMesh* m_mesh;
	int m_layer;
	Array<c_TSurface* > m_solid;
	int m_lastBlend;
	c_MojoSurface* m_lastSurface;
	c_Matrix* m_mat;
	c_Image* m_fontImage;
	String m_fontFile;
	Float m_colora;
	int m_colorr;
	int m_colorg;
	int m_colorb;
	Float m_zdepth;
	c_MojoEmulationDevice();
	static c_MojoEmulationDevice* m__device;
	static gxtkGraphics* m__olddevice;
	c_MojoEmulationDevice* m_new();
	static c_QuadCache* m__quadCache;
	void p_NewLayer();
	int p_Reset();
	static bool m_firstTimeRun;
	void p_InitFont();
	static void m_SetDevice();
	int Width();
	int Height();
	gxtkSurface* LoadSurface(String);
	gxtkSurface* CreateSurface(int,int);
	int WritePixels2(gxtkSurface*,Array<int >,int,int,int,int,int,int);
	int Cls(Float,Float,Float);
	int SetAlpha(Float);
	int SetColor(Float,Float,Float);
	int SetMatrix(Float,Float,Float,Float,Float,Float);
	int SetScissor(int,int,int,int);
	int SetBlend(int);
	int p_Check(c_MojoSurface*);
	void p_AddQuad(c_TSurface*,Float,Float,Float,Float,Float,Float,Float,Float);
	int DrawPoint(Float,Float);
	int DrawRect(Float,Float,Float,Float);
	int DrawLine(Float,Float,Float,Float);
	int DrawPoly(Array<Float >);
	int DrawOval(Float,Float,Float,Float);
	int DrawSurface2(gxtkSurface*,Float,Float,int,int,int,int);
	int DrawSurface(gxtkSurface*,Float,Float);
	int ReadPixels(Array<int >,int,int,int,int,int,int);
	void mark();
	String debug();
};
String dbg_type(c_MojoEmulationDevice**p){return "MojoEmulationDevice";}
gxtkGraphics* bb_graphics_GetGraphicsDevice();
class c_QuadCache : public Object{
	public:
	int m_q_num;
	Array<Float > m_q_cache;
	c_TSurface* m_q_surf;
	Array<int > m_q_tri;
	c_QuadCache();
	c_QuadCache* m_new();
	void p_FlushCache();
	void p_AddCache(c_TSurface*,Array<Float >);
	void mark();
	String debug();
};
String dbg_type(c_QuadCache**p){return "QuadCache";}
class c_TEntity : public Object{
	public:
	c_Matrix* m_mat;
	c_Matrix* m_loc_mat;
	String m_classname;
	c_TEntity* m_parent;
	Float m_px;
	Float m_py;
	Float m_pz;
	Float m_rx;
	Float m_ry;
	Float m_rz;
	Float m_sx;
	Float m_sy;
	Float m_sz;
	Float m_gsx;
	Float m_gsy;
	Float m_gsz;
	c_TCollision* m_collision;
	c_EntityList* m_child_list;
	c_Node2* m_parent_link;
	int m_order;
	c_Node2* m_entity_link;
	c_TBrush* m_brush;
	bool m_hide;
	String m_name;
	bool m_use_cam_layer;
	c_TCamera* m_cam_layer;
	Float m_cull_radius;
	int m_auto_fade;
	Float m_fade_near;
	Float m_fade_far;
	Float m_fade_alpha;
	bool m_using_alpha;
	Float m_alpha_order;
	int m_anim;
	int m_anim_render;
	c_TEntity();
	c_TEntity* m_new();
	void p_UpdateMat(bool);
	int p_AddParent(c_TEntity*);
	static c_EntityList* m_entity_list;
	c_TEntity* p_EntityFX(int);
	int p_EntityFX2();
	bool p_Hidden();
	Float p_EntityX(int);
	Float p_EntityY(int);
	Float p_EntityZ(int);
	Float p_EntityDistanceSquared(c_TEntity*);
	Float p_EntityDistance(c_TEntity*);
	Float p_X();
	void p_X2(Float);
	Float p_Y();
	void p_Y2(Float);
	Float p_Z();
	void p_Z2(Float);
	static c_Matrix* m_temp_mat;
	int p_UpdateMatTrans(bool);
	static int m_UpdateChildren(c_TEntity*,int);
	c_TEntity* p_PositionEntity(Float,Float,Float,int);
	c_TEntity* p_PositionEntity2(c_TEntity*);
	Float p_EntityPitch(int);
	Float p_EntityYaw(int);
	Float p_EntityRoll(int);
	int p_UpdateMatRot(bool);
	c_TEntity* p_RotateEntity(Float,Float,Float,int);
	c_TEntity* p_RotateEntity2(c_TEntity*);
	c_TEntity* p_EntityShininess(Float);
	c_TEntity* p_EntityTexture(c_TTexture*,int,int);
	c_TEntity* p_HideEntity();
	c_TEntity* p_MoveEntity(Float,Float,Float);
	c_TEntity* p_TurnEntity(Float,Float,Float,int);
	Float p_EntityScaleX(int);
	Float p_EntityScaleY(int);
	Float p_EntityScaleZ(int);
	virtual c_TEntity* p_ScaleEntity(Float,Float,Float,int);
	c_TEntity* p_ScaleEntity2(c_TEntity*);
	c_TEntity* p_EntityParent(c_TEntity*,bool);
	String p_EntityName();
	static c_Matrix* m_global_mat;
	void mark();
	String debug();
};
String dbg_type(c_TEntity**p){return "TEntity";}
class c_TMesh : public c_TEntity{
	public:
	c_List2* m_surf_list;
	int m_no_surfs;
	Array<c_TSurface* > m_anim_surf;
	Array<int > m_anim_surf_frame;
	int m_reset_bounds;
	c_TColTree* m_col_tree;
	int m_total_tris;
	Float m_min_x;
	Float m_max_x;
	Float m_min_y;
	Float m_max_y;
	Float m_min_z;
	Float m_max_z;
	c_Vector* m_vec_temp;
	Array<c_Vector* > m_vecbounds;
	Float m_center_x;
	Float m_center_y;
	Float m_center_z;
	Float m_distance_nearplane;
	bool m_culled;
	bool m_wireframe;
	bool m_is_sprite;
	c_TMesh();
	c_TMesh* m_new();
	static c_TMesh* m_CreateMesh(c_TEntity*);
	int p_CreateSurfaceID();
	c_TSurface* p_CreateSurface(c_TBrush*);
	c_TSurface* p_AddSurface(c_TSurface*);
	int p_GetTotalTris();
	int p_GetBounds(bool);
	int p_AutoFade(c_TCamera*);
	bool p_Alpha();
	static c_TMesh* m_CreateCube(c_TEntity*);
	int p_Draw(Float,Float,bool);
	c_TSurface* p_GetAnimSurface(c_TSurface*);
	c_TSurface* p_GetAnimSurface2(int);
	void p_UpdateVertexAnimFrame(c_TSurface*,c_TSurface*);
	void mark();
	String debug();
};
String dbg_type(c_TMesh**p){return "TMesh";}
class c_Matrix : public Object{
	public:
	Array<Array<Float > > m_grid;
	c_Matrix();
	c_Matrix* m_new();
	c_Matrix* m_new2(c_Vector*,c_Vector*,c_Vector*);
	void p_LoadIdentity();
	void p_Overwrite(c_Matrix*);
	void p_Translate(Float,Float,Float);
	void p_Rotate(Float,Float,Float);
	void p_Scale(Float,Float,Float);
	c_Matrix* p_Inverse();
	void p_Multiply4(c_Matrix*);
	c_Vector* p_Multiply42(c_Vector*);
	Array<Float > p_ToArray();
	void p_ToArray2(Array<Float >);
	Array<Float > p_TransformPoint(Float,Float,Float,Float);
	c_Matrix* p_Copy();
	void p_Multiply(c_Matrix*);
	c_Vector* p_Multiply2(c_Vector*);
	c_Line* p_Multiply3(c_Line*);
	void p_CreateMatrix(Float,Float,Float,Float,Float,Float,Float,Float,Float);
	void p_FastRotateScale(Float,Float,Float,Float,Float,Float);
	void p_RotateRoll(Float);
	void mark();
	String debug();
};
String dbg_type(c_Matrix**p){return "Matrix";}
class c_Vector : public Object{
	public:
	Float m_x;
	Float m_y;
	Float m_z;
	c_Vector();
	c_Vector* m_new(Float,Float,Float);
	c_Vector* p_Copy();
	c_Vector* p_Add(c_Vector*);
	c_Vector* p_Add2(Float,Float,Float);
	c_Vector* p_Subtract(c_Vector*);
	c_Vector* p_Subtract2(Float,Float,Float);
	c_Vector* p_Normalize();
	void mark();
	String debug();
};
String dbg_type(c_Vector**p){return "Vector";}
class c_TCollision : public Object{
	public:
	bool m_updated_shape;
	c_TCollision();
	c_TCollision* m_new();
	void mark();
	String debug();
};
String dbg_type(c_TCollision**p){return "TCollision";}
class c_List : public Object{
	public:
	c_Node2* m__head;
	c_List();
	c_List* m_new();
	c_Node2* p_AddLast(c_TEntity*);
	c_List* m_new2(Array<c_TEntity* >);
	c_Node2* p_FirstNode();
	c_Node2* p_AddFirst(c_TEntity*);
	c_Enumerator7* p_ObjectEnumerator();
	bool p_IsEmpty();
	void mark();
	String debug();
};
String dbg_type(c_List**p){return "List";}
class c_EntityList : public c_List{
	public:
	c_EntityList();
	c_EntityList* m_new();
	c_Node2* p_EntityListAdd(c_TEntity*);
	void mark();
	String debug();
};
String dbg_type(c_EntityList**p){return "EntityList";}
class c_Node2 : public Object{
	public:
	c_Node2* m__succ;
	c_Node2* m__pred;
	c_TEntity* m__data;
	c_Node2();
	c_Node2* m_new(c_Node2*,c_Node2*,c_TEntity*);
	c_Node2* m_new2();
	int p_Remove();
	void mark();
	String debug();
};
String dbg_type(c_Node2**p){return "Node";}
class c_HeadNode : public c_Node2{
	public:
	c_HeadNode();
	c_HeadNode* m_new();
	void mark();
	String debug();
};
String dbg_type(c_HeadNode**p){return "HeadNode";}
c_TMesh* bb_functions_CreateMesh(c_TEntity*);
class c_TBrush : public Object{
	public:
	Float m_red;
	Float m_green;
	Float m_blue;
	Array<c_TTexture* > m_tex;
	int m_no_texs;
	int m_fx;
	String m_name;
	Float m_alpha;
	Float m_shine;
	Float m_shine_strength;
	int m_blend;
	c_TBrush();
	c_TBrush* m_new();
	c_TBrush* m_new2(int);
	c_TBrush* m_new3(int,int,int);
	void p_BrushTexture(c_TTexture*,int,int);
	c_TBrush* m_new4(c_TTexture*);
	virtual c_TBrush* p_Copy();
	c_TTexture* p_GetTexture(int);
	void mark();
	String debug();
};
String dbg_type(c_TBrush**p){return "TBrush";}
class c_TTexture : public Object{
	public:
	bool m_resize_smooth;
	int m_no_frames;
	int m_tex_frame;
	int m_frame_xstep;
	int m_frame_ystep;
	Float m_frame_ustep;
	Float m_u_pos;
	Float m_frame_vstep;
	Float m_v_pos;
	int m_bind_flags;
	c_Node6* m_tex_link;
	c_TPixmap* m_pixmap;
	String m_file;
	Array<int > m_gltex;
	bool m_freeMemoryAfterBind;
	int m_flags;
	int m_orig_width;
	int m_orig_height;
	int m_width;
	int m_height;
	int m_frame_startx;
	int m_frame_starty;
	Float m_u_scale;
	Float m_v_scale;
	bool m_is_font;
	int m_blend;
	int m_coords;
	Float m_angle;
	int m_cube_mode;
	bool m_tex_smooth;
	int m_no_mipmaps;
	c_TTexture();
	static bool m_useGlobalResizeSmooth;
	c_TTexture* m_new();
	static c_TextureStack* m_tex_bind_stack;
	int p_FreeTexture_();
	int p_FilterFlags();
	static c_List12* m_tex_list;
	c_TTexture* p_TexInList();
	static int m_Pow2Size(int);
	static c_TPixmap* m_AdjustPixmap(c_TPixmap*,bool,c_TTexture*);
	void p_SetAnimationFrames(int,int,int,int);
	static int m_PushBindTexture(c_TTexture*,int);
	static c_TTexture* m_LoadAnimTexture(String,int,int,int,int,int,c_TTexture*,int);
	static c_TTexture* m_LoadTexture(String,int,c_TTexture*);
	static c_TTexture* m_LoadTexture2(c_TPixmap*,int,c_TTexture*);
	int p_TextureBlend(int);
	static c_TTexture* m_CreateTexture(int,int,int,int,c_TTexture*);
	static int m_TextureFilter(String,int);
	int p_ResizeNoSmooth();
	int p_FreeTexture();
	void mark();
	String debug();
};
String dbg_type(c_TTexture**p){return "TTexture";}
class c_TSurface : public Object{
	public:
	c_TBrush* m_brush;
	int m_surf_id;
	int m_no_verts;
	int m_no_tris;
	bool m_vbo_dyn;
	c_VertexDataBuffer* m_vert_data;
	bool m_alpha_enable;
	int m_vert_array_size;
	int m_tri_array_size;
	c_ShortBuffer* m_tris;
	int m_reset_vbo;
	Array<int > m_vbo_id;
	Array<c_TVertexAnim* > m_vert_anim;
	int m_anim_frame;
	c_TSurface();
	c_TSurface* m_new();
	int p_AddVertex(Float,Float,Float,Float,Float,Float);
	int p_AddVertex2(Array<Float >,int);
	int p_AddTriangle(int,int,int);
	int p_AddTriangle2(Array<int >,int);
	int p_VertexNormal(int,Float,Float,Float);
	int p_VertexTexCoords(int,Float,Float,Float,int);
	int p_CropSurfaceBuffers();
	int p_ClearSurface(bool,bool,bool);
	int p_TriangleVertex(int,int);
	int p_UpdateNormals(bool);
	int p_VertexColor(int,Float,Float,Float,Float);
	int p_PaintSurface(c_TBrush*);
	int p_PaintSurface2(c_TTexture*,int);
	void mark();
	String debug();
};
String dbg_type(c_TSurface**p){return "TSurface";}
class c_List2 : public Object{
	public:
	c_Node3* m__head;
	c_List2();
	c_List2* m_new();
	c_Node3* p_AddLast2(c_TSurface*);
	c_List2* m_new2(Array<c_TSurface* >);
	int p_Clear();
	c_Enumerator8* p_ObjectEnumerator();
	void mark();
	String debug();
};
String dbg_type(c_List2**p){return "List";}
class c_Node3 : public Object{
	public:
	c_Node3* m__succ;
	c_Node3* m__pred;
	c_TSurface* m__data;
	c_Node3();
	c_Node3* m_new(c_Node3*,c_Node3*,c_TSurface*);
	c_Node3* m_new2();
	void mark();
	String debug();
};
String dbg_type(c_Node3**p){return "Node";}
class c_HeadNode2 : public c_Node3{
	public:
	c_HeadNode2();
	c_HeadNode2* m_new();
	void mark();
	String debug();
};
String dbg_type(c_HeadNode2**p){return "HeadNode";}
class c_TColTree : public Object{
	public:
	int m_reset_col_tree;
	c_TColTree();
	c_TColTree* m_new();
	void mark();
	String debug();
};
String dbg_type(c_TColTree**p){return "TColTree";}
class c_MojoSurface : public gxtkSurface{
	public:
	c_TTexture* m_tex;
	String m_path;
	int m_loaded;
	Float m_xstep;
	Float m_ystep;
	c_MojoSurface();
	c_MojoSurface* m_new();
	static c_MojoSurface* m_Create(String);
	static Array<String > m_list;
	static bool m_isLoading;
	int Width();
	int Height();
	bool p_LoadTexture(String,c_TMesh*,c_MojoEmulationDevice*);
	static c_MojoSurface* m_PreLoad(String,c_TMesh*,c_MojoEmulationDevice*);
	int Discard();
	int Loaded();
	void mark();
	String debug();
};
String dbg_type(c_MojoSurface**p){return "MojoSurface";}
class c_List3 : public Object{
	public:
	c_Node4* m__head;
	c_List3();
	c_List3* m_new();
	c_Node4* p_AddLast3(c_TMesh*);
	c_List3* m_new2(Array<c_TMesh* >);
	int p_Clear();
	virtual int p_Compare2(c_TMesh*,c_TMesh*);
	int p_Sort(int);
	c_Enumerator9* p_ObjectEnumerator();
	bool p_IsEmpty();
	void mark();
	String debug();
};
String dbg_type(c_List3**p){return "List";}
class c_Node4 : public Object{
	public:
	c_Node4* m__succ;
	c_Node4* m__pred;
	c_TMesh* m__data;
	c_Node4();
	c_Node4* m_new(c_Node4*,c_Node4*,c_TMesh*);
	c_Node4* m_new2();
	void mark();
	String debug();
};
String dbg_type(c_Node4**p){return "Node";}
class c_HeadNode3 : public c_Node4{
	public:
	c_HeadNode3();
	c_HeadNode3* m_new();
	void mark();
	String debug();
};
String dbg_type(c_HeadNode3**p){return "HeadNode";}
class c_TPixmap : public Object{
	public:
	int m_bind;
	int m_width;
	int m_height;
	c_TPixmap();
	static c_TPixmapPreloader* m_preloader;
	static int m_PreLoadPixmap(Array<String >);
	void p_DecBind();
	int p_GetBindCount();
	virtual void p_FreePixmap()=0;
	static c_IPixmapManager* m_manager;
	static c_TPixmap* m_LoadPixmap(String);
	virtual c_TPixmap* p_ResizePixmapNoSmooth(int,int)=0;
	c_TPixmap* p_Copy();
	virtual void p_MaskPixmap(int,int,int);
	virtual c_TPixmap* p_ResizePixmap(int,int)=0;
	virtual void p_SetPixel(int,int,int,int,int,int);
	static c_TPixmap* m_CreatePixmap(int,int,int);
	c_TPixmap* m_new();
	virtual int p_GetPixel(int,int);
	void p_SetBind();
	void p_ClearBind();
	void mark();
	String debug();
};
String dbg_type(c_TPixmap**p){return "TPixmap";}
class c_TPixmapPreloader : public Object{
	public:
	c_IPreloadManager* m_manager;
	Array<String > m_old_file;
	c_Stack2* m_start_stack;
	c_Stack2* m_finish_stack;
	int m_total;
	bool m_loading;
	c_TPixmapPreloader();
	int p_CheckAllLoaded();
	int p_PreLoad2(Array<String >);
	void p_RemoveFromStack(String);
	c_TPixmapPreloader* m_new(c_IPreloadManager*);
	c_TPixmapPreloader* m_new2();
	int p_GetID(String);
	void p_GetPixmapPreLoad(c_TPixmap*,String);
	void mark();
	String debug();
};
String dbg_type(c_TPixmapPreloader**p){return "TPixmapPreloader";}
class c_IPreloadManager : public virtual gc_interface{
	public:
	virtual void p_PreLoadData(String,int)=0;
	virtual bool p_IsLoaded(int)=0;
	virtual void p_SetPixmapFromID(c_TPixmap*,int,String)=0;
};
class c_PixmapStack : public Object{
	public:
	String m_file;
	String m_new_file;
	int m_id;
	bool m_loading;
	c_PixmapStack();
	c_PixmapStack* m_new(String,String,int);
	c_PixmapStack* m_new2();
	void mark();
	String debug();
};
String dbg_type(c_PixmapStack**p){return "PixmapStack";}
class c_Stack2 : public Object{
	public:
	Array<c_PixmapStack* > m_data;
	int m_length;
	c_Stack2();
	c_Stack2* m_new();
	c_Stack2* m_new2(Array<c_PixmapStack* >);
	c_Enumerator* p_ObjectEnumerator();
	static c_PixmapStack* m_NIL;
	void p_Length(int);
	int p_Length2();
	void p_Insert2(int,c_PixmapStack*);
	bool p_IsEmpty();
	c_BackwardsStack* p_Backwards();
	bool p_Equals(c_PixmapStack*,c_PixmapStack*);
	void p_RemoveEach(c_PixmapStack*);
	void p_Push4(c_PixmapStack*);
	void p_Push5(Array<c_PixmapStack* >,int,int);
	void p_Push6(Array<c_PixmapStack* >,int);
	void p_Remove2(int);
	void mark();
	String debug();
};
String dbg_type(c_Stack2**p){return "Stack";}
class c_Enumerator : public Object{
	public:
	c_Stack2* m_stack;
	int m_index;
	c_Enumerator();
	c_Enumerator* m_new(c_Stack2*);
	c_Enumerator* m_new2();
	bool p_HasNext();
	c_PixmapStack* p_NextObject();
	void mark();
	String debug();
};
String dbg_type(c_Enumerator**p){return "Enumerator";}
int bb_math2_Max(int,int);
Float bb_math2_Max2(Float,Float);
class c_BackwardsStack : public Object{
	public:
	c_Stack2* m_stack;
	c_BackwardsStack();
	c_BackwardsStack* m_new(c_Stack2*);
	c_BackwardsStack* m_new2();
	c_BackwardsEnumerator* p_ObjectEnumerator();
	void mark();
	String debug();
};
String dbg_type(c_BackwardsStack**p){return "BackwardsStack";}
class c_BackwardsEnumerator : public Object{
	public:
	c_Stack2* m_stack;
	int m_index;
	c_BackwardsEnumerator();
	c_BackwardsEnumerator* m_new(c_Stack2*);
	c_BackwardsEnumerator* m_new2();
	bool p_HasNext();
	c_PixmapStack* p_NextObject();
	void mark();
	String debug();
};
String dbg_type(c_BackwardsEnumerator**p){return "BackwardsEnumerator";}
int bb_functions_PreLoadPixmap(Array<String >);
int bb_functions_PreLoadPixmap2(String);
void bb_mojographics_SetMojoEmulation();
int bb_opengles11_SetRender(int);
class c_List4 : public Object{
	public:
	c_Node5* m__head;
	c_List4();
	c_List4* m_new();
	c_Node5* p_AddLast4(String);
	c_List4* m_new2(Array<String >);
	int p_Count();
	c_Enumerator2* p_ObjectEnumerator();
	Array<String > p_ToArray();
	void mark();
	String debug();
};
String dbg_type(c_List4**p){return "List";}
class c_StringList : public c_List4{
	public:
	c_StringList();
	c_StringList* m_new(Array<String >);
	c_StringList* m_new2();
	void mark();
	String debug();
};
String dbg_type(c_StringList**p){return "StringList";}
class c_Node5 : public Object{
	public:
	c_Node5* m__succ;
	c_Node5* m__pred;
	String m__data;
	c_Node5();
	c_Node5* m_new(c_Node5*,c_Node5*,String);
	c_Node5* m_new2();
	void mark();
	String debug();
};
String dbg_type(c_Node5**p){return "Node";}
class c_HeadNode4 : public c_Node5{
	public:
	c_HeadNode4();
	c_HeadNode4* m_new();
	void mark();
	String debug();
};
String dbg_type(c_HeadNode4**p){return "HeadNode";}
class c_Enumerator2 : public Object{
	public:
	c_List4* m__list;
	c_Node5* m__curr;
	c_Enumerator2();
	c_Enumerator2* m_new(c_List4*);
	c_Enumerator2* m_new2();
	bool p_HasNext();
	String p_NextObject();
	void mark();
	String debug();
};
String dbg_type(c_Enumerator2**p){return "Enumerator";}
int bb_app2_Millisecs();
class c_Stack3 : public Object{
	public:
	Array<c_TTexture* > m_data;
	int m_length;
	c_Stack3();
	c_Stack3* m_new();
	c_Stack3* m_new2(Array<c_TTexture* >);
	static c_TTexture* m_NIL;
	void p_Length(int);
	int p_Length2();
	c_Enumerator3* p_ObjectEnumerator();
	void p_Clear();
	void p_Push7(c_TTexture*);
	void p_Push8(Array<c_TTexture* >,int,int);
	void p_Push9(Array<c_TTexture* >,int);
	void mark();
	String debug();
};
String dbg_type(c_Stack3**p){return "Stack";}
class c_TextureStack : public c_Stack3{
	public:
	c_TextureStack();
	c_TextureStack* m_new();
	void mark();
	String debug();
};
String dbg_type(c_TextureStack**p){return "TextureStack";}
class c_Enumerator3 : public Object{
	public:
	c_Stack3* m_stack;
	int m_index;
	c_Enumerator3();
	c_Enumerator3* m_new(c_Stack3*);
	c_Enumerator3* m_new2();
	bool p_HasNext();
	c_TTexture* p_NextObject();
	void mark();
	String debug();
};
String dbg_type(c_Enumerator3**p){return "Enumerator";}
class c_Node6 : public Object{
	public:
	c_Node6* m__succ;
	c_Node6* m__pred;
	c_TTexture* m__data;
	c_Node6();
	int p_Remove();
	c_Node6* m_new(c_Node6*,c_Node6*,c_TTexture*);
	c_Node6* m_new2();
	void mark();
	String debug();
};
String dbg_type(c_Node6**p){return "Node";}
class c_TCamera : public c_TEntity{
	public:
	Float m_fov_y;
	Float m_range_near;
	Float m_range_far;
	Float m_aspect;
	Array<int > m_viewport;
	Float m_eyedx;
	Float m_focus;
	Float m_eyedy;
	int m_proj_mode;
	c_Matrix* m_proj_mat;
	int m_draw2D;
	int m_oldw;
	int m_vwidth;
	int m_oldh;
	int m_vheight;
	int m_vx;
	int m_vy;
	c_Matrix* m_mod_mat;
	c_Matrix* m_view_mat;
	c_Matrix* m_projview_mat;
	Array<Array<Float > > m_frustum;
	bool m_cls_color;
	bool m_cls_zbuffer;
	Float m_zoom;
	Float m_inv_zoom;
	c_Node7* m_cam_link;
	Float m_cls_r;
	Float m_cls_g;
	Float m_cls_b;
	int m_fog_mode;
	Float m_fog_range_near;
	Float m_fog_range_far;
	Float m_fog_r;
	Float m_fog_g;
	Float m_fog_b;
	c_TCamera();
	static c_EntityList2* m_cam_list;
	int p_SetPixelCamera();
	int p_accFrustum(Float,Float,Float,Float,Float,Float,Float,Float);
	int p_accPerspective(Float,Float,Float,Float,Float);
	int p_ExtractFrustum();
	int p_Update2(c_TCamera*);
	Float p_EntityInFrustum(c_TEntity*);
	c_TCamera* m_new();
	int p_CameraClsMode(bool,bool);
	int p_CameraZoom(Float);
	int p_CameraViewport(int,int,int,int);
	static c_TCamera* m_CreateCamera(c_TEntity*);
	int p_CameraClsColor(Float,Float,Float);
	int p_CameraScissor(int,int,int,int);
	void mark();
	String debug();
};
String dbg_type(c_TCamera**p){return "TCamera";}
class c_List5 : public Object{
	public:
	c_Node7* m__head;
	c_List5();
	c_List5* m_new();
	c_Node7* p_AddLast5(c_TCamera*);
	c_List5* m_new2(Array<c_TCamera* >);
	c_Enumerator4* p_ObjectEnumerator();
	int p_Count();
	c_Node7* p_FirstNode();
	c_Node7* p_AddFirst2(c_TCamera*);
	void mark();
	String debug();
};
String dbg_type(c_List5**p){return "List";}
class c_EntityList2 : public c_List5{
	public:
	c_EntityList2();
	c_EntityList2* m_new();
	c_Node7* p_EntityListAdd2(c_TCamera*);
	void mark();
	String debug();
};
String dbg_type(c_EntityList2**p){return "EntityList";}
class c_Node7 : public Object{
	public:
	c_Node7* m__succ;
	c_Node7* m__pred;
	c_TCamera* m__data;
	c_Node7();
	c_Node7* m_new(c_Node7*,c_Node7*,c_TCamera*);
	c_Node7* m_new2();
	void mark();
	String debug();
};
String dbg_type(c_Node7**p){return "Node";}
class c_HeadNode5 : public c_Node7{
	public:
	c_HeadNode5();
	c_HeadNode5* m_new();
	void mark();
	String debug();
};
String dbg_type(c_HeadNode5**p){return "HeadNode";}
class c_Enumerator4 : public Object{
	public:
	c_List5* m__list;
	c_Node7* m__curr;
	c_Enumerator4();
	c_Enumerator4* m_new(c_List5*);
	c_Enumerator4* m_new2();
	bool p_HasNext();
	c_TCamera* p_NextObject();
	void mark();
	String debug();
};
String dbg_type(c_Enumerator4**p){return "Enumerator";}
class c_TShader : public c_TBrush{
	public:
	c_TShader();
	static c_List6* m_process_list;
	static int m_PreProcess(c_TCamera*);
	static c_TShader* m_g_shader;
	static int m_PostProcess(c_TCamera*);
	c_TBrush* p_Copy()=0;
	void mark();
	String debug();
};
String dbg_type(c_TShader**p){return "TShader";}
class c_List6 : public Object{
	public:
	c_Node8* m__head;
	c_List6();
	c_List6* m_new();
	c_Node8* p_AddLast6(c_TShader*);
	c_List6* m_new2(Array<c_TShader* >);
	c_Enumerator5* p_ObjectEnumerator();
	void mark();
	String debug();
};
String dbg_type(c_List6**p){return "List";}
class c_Node8 : public Object{
	public:
	c_Node8* m__succ;
	c_Node8* m__pred;
	c_TShader* m__data;
	c_Node8();
	c_Node8* m_new(c_Node8*,c_Node8*,c_TShader*);
	c_Node8* m_new2();
	void mark();
	String debug();
};
String dbg_type(c_Node8**p){return "Node";}
class c_HeadNode6 : public c_Node8{
	public:
	c_HeadNode6();
	c_HeadNode6* m_new();
	void mark();
	String debug();
};
String dbg_type(c_HeadNode6**p){return "HeadNode";}
class c_Enumerator5 : public Object{
	public:
	c_List6* m__list;
	c_Node8* m__curr;
	c_Enumerator5();
	c_Enumerator5* m_new(c_List6*);
	c_Enumerator5* m_new2();
	bool p_HasNext();
	c_TShader* p_NextObject();
	void mark();
	String debug();
};
String dbg_type(c_Enumerator5**p){return "Enumerator";}
class c_IShaderProcess : public virtual gc_interface{
	public:
	virtual int p_PreProcess(c_TCamera*)=0;
	virtual int p_PostProcess(c_TCamera*)=0;
};
class c_IShaderRender : public virtual c_IShaderProcess{
	public:
	virtual int p_Render3(c_TCamera*)=0;
	virtual int p_PreProcess(c_TCamera*)=0;
	virtual int p_PostProcess(c_TCamera*)=0;
};
class c_TLight : public c_TEntity{
	public:
	int m_light_type;
	c_Node9* m_light_link;
	Float m_const_att;
	Float m_lin_att;
	bool m_remove_light;
	Float m_spec_red;
	Float m_spec_grn;
	Float m_spec_blu;
	Float m_spec_a;
	Float m_spot_exp;
	Float m_red;
	Float m_green;
	Float m_blue;
	Float m_outer_ang;
	c_TLight();
	static c_List7* m_light_list;
	static int m_no_lights;
	static int m_max_lights;
	c_TLight* m_new();
	static c_TLight* m_CreateLight(int,c_TEntity*);
	static Float m_ambient_red;
	static Float m_ambient_green;
	static Float m_ambient_blue;
	void mark();
	String debug();
};
String dbg_type(c_TLight**p){return "TLight";}
class c_List7 : public Object{
	public:
	c_Node9* m__head;
	c_List7();
	c_List7* m_new();
	c_Node9* p_AddLast7(c_TLight*);
	c_List7* m_new2(Array<c_TLight* >);
	c_Enumerator6* p_ObjectEnumerator();
	void mark();
	String debug();
};
String dbg_type(c_List7**p){return "List";}
class c_Node9 : public Object{
	public:
	c_Node9* m__succ;
	c_Node9* m__pred;
	c_TLight* m__data;
	c_Node9();
	c_Node9* m_new(c_Node9*,c_Node9*,c_TLight*);
	c_Node9* m_new2();
	int p_Remove();
	void mark();
	String debug();
};
String dbg_type(c_Node9**p){return "Node";}
class c_HeadNode7 : public c_Node9{
	public:
	c_HeadNode7();
	c_HeadNode7* m_new();
	void mark();
	String debug();
};
String dbg_type(c_HeadNode7**p){return "HeadNode";}
class c_Enumerator6 : public Object{
	public:
	c_List7* m__list;
	c_Node9* m__curr;
	c_Enumerator6();
	c_Enumerator6* m_new(c_List7*);
	c_Enumerator6* m_new2();
	bool p_HasNext();
	c_TLight* p_NextObject();
	void mark();
	String debug();
};
String dbg_type(c_Enumerator6**p){return "Enumerator";}
class c_RenderAlphaList : public c_List3{
	public:
	c_RenderAlphaList();
	c_RenderAlphaList* m_new();
	int p_Compare2(c_TMesh*,c_TMesh*);
	void mark();
	String debug();
};
String dbg_type(c_RenderAlphaList**p){return "RenderAlphaList";}
class c_Enumerator7 : public Object{
	public:
	c_List* m__list;
	c_Node2* m__curr;
	c_Enumerator7();
	c_Enumerator7* m_new(c_List*);
	c_Enumerator7* m_new2();
	bool p_HasNext();
	c_TEntity* p_NextObject();
	void mark();
	String debug();
};
String dbg_type(c_Enumerator7**p){return "Enumerator";}
class c_Enumerator8 : public Object{
	public:
	c_List2* m__list;
	c_Node3* m__curr;
	c_Enumerator8();
	c_Enumerator8* m_new(c_List2*);
	c_Enumerator8* m_new2();
	bool p_HasNext();
	c_TSurface* p_NextObject();
	void mark();
	String debug();
};
String dbg_type(c_Enumerator8**p){return "Enumerator";}
class c_VertexDataBuffer : public Object{
	public:
	c_DataBuffer* m_buf;
	c_VertexDataBuffer();
	c_VertexDataBuffer* m_new();
	void p_GetVertCoords(c_Vector*,int);
	static c_VertexDataBuffer* m_Create(int);
	void p_PokeFloatArray(int,Array<Float >,int);
	int p_PokeNormals(int,Float,Float,Float);
	int p_PokeTexCoords0(int,Float,Float);
	int p_PokeTexCoords1(int,Float,Float);
	Float p_VertexX(int);
	Float p_VertexY(int);
	Float p_VertexZ(int);
	c_Vector* p_PeekVertCoords(int);
	c_DataBuffer* p_BufferSlice(int);
	int p_PokeColor(int,Float,Float,Float,Float);
	void mark();
	String debug();
};
String dbg_type(c_VertexDataBuffer**p){return "VertexDataBuffer";}
class c_DataBuffer : public BBDataBuffer{
	public:
	c_DataBuffer();
	c_DataBuffer* m_new(int);
	c_DataBuffer* m_new2();
	void p_PokeBytes(int,Array<int >,int,int);
	int p_PokeString(int,String,String);
	void p_CopyBytes(int,c_DataBuffer*,int,int);
	c_DataBuffer* p_Slice(int,int);
	c_DataBuffer* p_Slice2(int);
	void p_PeekBytes(int,Array<int >,int,int);
	Array<int > p_PeekBytes2(int,int);
	String p_PeekString(int,int,String);
	String p_PeekString2(int,String);
	void mark();
	String debug();
};
String dbg_type(c_DataBuffer**p){return "DataBuffer";}
int bb_math2_Abs(int);
Float bb_math2_Abs2(Float);
class c_IRenderUpdate : public virtual gc_interface{
	public:
	virtual int p_Update2(c_TCamera*)=0;
};
class c_Enumerator9 : public Object{
	public:
	c_List3* m__list;
	c_Node4* m__curr;
	c_Enumerator9();
	c_Enumerator9* m_new(c_List3*);
	c_Enumerator9* m_new2();
	bool p_HasNext();
	c_TMesh* p_NextObject();
	void mark();
	String debug();
};
String dbg_type(c_Enumerator9**p){return "Enumerator";}
class c_IShader2D : public virtual gc_interface{
	public:
	virtual void p_SetShader2D()=0;
};
class c_BlankShader : public Object,public virtual c_IShader2D{
	public:
	c_BlankShader();
	c_BlankShader* m_new();
	void p_SetShader2D();
	void mark();
	String debug();
};
String dbg_type(c_BlankShader**p){return "BlankShader";}
c_DataBuffer* bb_monkeybuffer_CreateDataBuffer(int);
int bb_monkeybuffer_GetBufferLength(c_DataBuffer*);
c_DataBuffer* bb_monkeybuffer_CopyDataBuffer(c_DataBuffer*,c_DataBuffer*);
c_VertexDataBuffer* bb_monkeybuffer_CopyDataBuffer2(c_VertexDataBuffer*,c_VertexDataBuffer*);
c_VertexDataBuffer* bb_monkeybuffer_CopyDataBuffer3(c_VertexDataBuffer*,c_VertexDataBuffer*,int,int);
class c_ShortBuffer : public Object{
	public:
	c_DataBuffer* m_buf;
	c_ShortBuffer();
	c_ShortBuffer* m_new();
	static c_DataBuffer* m_i2f;
	static c_ShortBuffer* m_Create(int);
	int p_Length2();
	int p_Peek(int);
	void p_Poke(int,Array<int >,int);
	void p_Poke2(int,int);
	void mark();
	String debug();
};
String dbg_type(c_ShortBuffer**p){return "ShortBuffer";}
c_ShortBuffer* bb_monkeybuffer_CopyShortBuffer(c_ShortBuffer*,c_ShortBuffer*);
Array<Array<Float > > bb_monkeyutility_AllocateFloatArray(int,int);
class c_TSprite : public c_TMesh,public virtual c_IRenderUpdate{
	public:
	Array<Float > m_pixel_scale;
	c_Matrix* m_mat_sp;
	Float m_scale_x;
	Float m_scale_y;
	int m_view_mode;
	Float m_angle;
	Float m_handle_x;
	Float m_handle_y;
	c_TSprite();
	c_TSprite* m_new();
	c_TEntity* p_ScaleSprite(Float,Float);
	c_TEntity* p_ScaleEntity(Float,Float,Float,int);
	static c_Matrix* m_temp_mat;
	int p_Update2(c_TCamera*);
	void mark();
	String debug();
};
String dbg_type(c_TSprite**p){return "TSprite";}
int bb_functions_RenderWorld();
class c_CalLoaderHandler : public Object{
	public:
	c_List8* m_LoaderCallbacks;
	c_CalLoaderHandler();
	c_CalLoaderHandler* m_new();
	int p_LoadFile(String,int,c_CalLoader*,String);
	bool p_IsFileLoaded(String);
	Object* p_GetLoadedFile(String,bool);
	int p_Update();
	void mark();
	String debug();
};
String dbg_type(c_CalLoaderHandler**p){return "CalLoaderHandler";}
class c_IOnHttpRequestComplete : public virtual gc_interface{
	public:
	virtual void p_OnHttpRequestComplete(c_HttpRequest*)=0;
};
class c_CalLoadingCallback : public Object,public virtual c_IOnHttpRequestComplete{
	public:
	c_CalLoader* m_loader;
	String m_fileurl;
	c_HttpRequest* m_get_req;
	bool m_hasheader;
	String m_headername;
	String m_headerval;
	c_HttpRequest* m_post_req;
	bool m_finished;
	int m_bytesrec;
	String m_data;
	c_CalLoadingCallback();
	c_CalLoadingCallback* m_new();
	void p_SetLoader(c_CalLoader*);
	void p_Load(int,String,String,String,String);
	bool p_IsFinished();
	Object* p_GetLoadedObject();
	void p_Update();
	void p_OnHttpRequestComplete(c_HttpRequest*);
	void mark();
	String debug();
};
String dbg_type(c_CalLoadingCallback**p){return "CalLoadingCallback";}
class c_List8 : public Object{
	public:
	c_Node10* m__head;
	c_List8();
	c_List8* m_new();
	c_Node10* p_AddLast8(c_CalLoadingCallback*);
	c_List8* m_new2(Array<c_CalLoadingCallback* >);
	c_Enumerator13* p_ObjectEnumerator();
	bool p_Equals2(c_CalLoadingCallback*,c_CalLoadingCallback*);
	int p_RemoveEach2(c_CalLoadingCallback*);
	void p_Remove3(c_CalLoadingCallback*);
	void mark();
	String debug();
};
String dbg_type(c_List8**p){return "List";}
class c_Node10 : public Object{
	public:
	c_Node10* m__succ;
	c_Node10* m__pred;
	c_CalLoadingCallback* m__data;
	c_Node10();
	c_Node10* m_new(c_Node10*,c_Node10*,c_CalLoadingCallback*);
	c_Node10* m_new2();
	int p_Remove();
	void mark();
	String debug();
};
String dbg_type(c_Node10**p){return "Node";}
class c_HeadNode8 : public c_Node10{
	public:
	c_HeadNode8();
	c_HeadNode8* m_new();
	void mark();
	String debug();
};
String dbg_type(c_HeadNode8**p){return "HeadNode";}
class c_CalLoader : public Object{
	public:
	bool m_loaded;
	Object* m_loadedobject;
	c_CalLoader();
	c_CalLoader* m_new();
	bool p_IsLoaded2();
	Object* p_GetLoadedObject();
	virtual Object* p_Load2(String);
	void mark();
	String debug();
};
String dbg_type(c_CalLoader**p){return "CalLoader";}
class c_SKNCalSkeletonLoader : public c_CalLoader{
	public:
	c_SKNCalSkeletonLoader();
	c_SKNCalSkeletonLoader* m_new();
	Object* p_Load2(String);
	void mark();
	String debug();
};
String dbg_type(c_SKNCalSkeletonLoader**p){return "SKNCalSkeletonLoader";}
class c_IOnConnectComplete : public virtual gc_interface{
	public:
	virtual void p_OnConnectComplete(bool,c_Socket*)=0;
};
class c_IOnSendComplete : public virtual gc_interface{
	public:
	virtual void p_OnSendComplete(c_DataBuffer*,int,int,c_Socket*)=0;
};
class c_IOnReceiveComplete : public virtual gc_interface{
	public:
	virtual void p_OnReceiveComplete(c_DataBuffer*,int,int,c_Socket*)=0;
};
class c_HttpRequest : public Object,public virtual c_IOnConnectComplete,public virtual c_IOnSendComplete,public virtual c_IOnReceiveComplete{
	public:
	String m__req;
	c_Url* m__url;
	c_IOnHttpRequestComplete* m__onComplete;
	c_DataBuffer* m__data;
	int m__dataLength;
	int m__status;
	c_StringStack* m__response;
	String m__responseText;
	int m__bytesReceived;
	c_StringStack* m__header;
	c_Socket* m__sock;
	c_DataBuffer* m__wbuf;
	c_DataBuffer* m__rbuf;
	c_HttpRequest();
	c_HttpRequest* m_new();
	void p_Open(String,String,c_IOnHttpRequestComplete*);
	c_HttpRequest* m_new2(String,String,c_IOnHttpRequestComplete*);
	void p_SetHeader(String,String);
	void p_Send();
	void p_Send2(String,String,String);
	int p_BytesReceived();
	void p_Finish();
	void p_OnConnectComplete(bool,c_Socket*);
	int p_Status();
	String p_ResponseText();
	void p_OnReceiveComplete(c_DataBuffer*,int,int,c_Socket*);
	void p_OnSendComplete(c_DataBuffer*,int,int,c_Socket*);
	void mark();
	String debug();
};
String dbg_type(c_HttpRequest**p){return "HttpRequest";}
class c_Url : public Object{
	public:
	String m__defaultScheme;
	int m__defaultPort;
	String m__url;
	String m__scheme;
	String m__username;
	String m__password;
	String m__domain;
	int m__port;
	String m__path;
	String m__query;
	String m__fragment;
	c_Url();
	void p_Set2(String);
	c_Url* m_new(String,String,int);
	c_Url* m_new2();
	String p_FullPath();
	String p_Domain();
	int p_Port();
	void mark();
	String debug();
};
String dbg_type(c_Url**p){return "Url";}
class c_Stack4 : public Object{
	public:
	Array<String > m_data;
	int m_length;
	c_Stack4();
	c_Stack4* m_new();
	c_Stack4* m_new2(Array<String >);
	void p_Push10(String);
	void p_Push11(Array<String >,int,int);
	void p_Push12(Array<String >,int);
	Array<String > p_ToArray();
	static String m_NIL;
	void p_Clear();
	void p_Length(int);
	int p_Length2();
	String p_Get(int);
	void mark();
	String debug();
};
String dbg_type(c_Stack4**p){return "Stack";}
class c_StringStack : public c_Stack4{
	public:
	c_StringStack();
	c_StringStack* m_new(Array<String >);
	c_StringStack* m_new2();
	String p_Join(String);
	void mark();
	String debug();
};
String dbg_type(c_StringStack**p){return "StringStack";}
class c_IAsyncEventSource : public virtual gc_interface{
	public:
	virtual void p_UpdateAsyncEvents()=0;
};
class c_Socket : public Object,public virtual c_IAsyncEventSource{
	public:
	BBSocket* m__sock;
	int m__proto;
	int m__state;
	c_AsyncQueue* m__rthread;
	c_AsyncQueue* m__wthread;
	c_Socket();
	void p_Start();
	c_Socket* m_new(String);
	c_Socket* m_new2(BBSocket*,int,int);
	bool p_IsOpen();
	bool p_IsConnected();
	bool p_IsListening();
	void p_ConnectAsync(String,int,c_IOnConnectComplete*);
	void p_UpdateAsyncEvents();
	void p_OnConnectComplete2();
	void p_Close();
	void p_SendAsync(c_DataBuffer*,int,int,c_IOnSendComplete*);
	void p_ReceiveAsync(c_DataBuffer*,int,int,c_IOnReceiveComplete*);
	void mark();
	String debug();
};
String dbg_type(c_Socket**p){return "Socket";}
class c_Thread : public BBThread{
	public:
	c_Thread();
	static c_Stack5* m__zombies;
	static c_Stack5* m__zombies2;
	static c_Stack5* m__alive;
	c_Thread* m_new();
	void mark();
	String debug();
};
String dbg_type(c_Thread**p){return "Thread";}
class c_AsyncQueue : public c_Thread,public virtual c_IAsyncEventSource{
	public:
	c_Socket* m_source;
	Array<c_AsyncOp* > m_queue;
	int m_put;
	int m_get;
	int m_nxt;
	c_AsyncQueue();
	c_AsyncQueue* m_new(c_Socket*);
	c_AsyncQueue* m_new2();
	void p_Enqueue(c_AsyncOp*);
	void p_UpdateAsyncEvents();
	void Run__UNSAFE__();
	void mark();
	String debug();
};
String dbg_type(c_AsyncQueue**p){return "AsyncQueue";}
class c_Stack5 : public Object{
	public:
	Array<c_Thread* > m_data;
	int m_length;
	c_Stack5();
	c_Stack5* m_new();
	c_Stack5* m_new2(Array<c_Thread* >);
	c_Enumerator10* p_ObjectEnumerator();
	static c_Thread* m_NIL;
	void p_Length(int);
	int p_Length2();
	void p_Push13(c_Thread*);
	void p_Push14(Array<c_Thread* >,int,int);
	void p_Push15(Array<c_Thread* >,int);
	void p_Clear();
	void mark();
	String debug();
};
String dbg_type(c_Stack5**p){return "Stack";}
class c_Enumerator10 : public Object{
	public:
	c_Stack5* m_stack;
	int m_index;
	c_Enumerator10();
	c_Enumerator10* m_new(c_Stack5*);
	c_Enumerator10* m_new2();
	bool p_HasNext();
	c_Thread* p_NextObject();
	void mark();
	String debug();
};
String dbg_type(c_Enumerator10**p){return "Enumerator";}
class c_Stack6 : public Object{
	public:
	Array<c_IAsyncEventSource* > m_data;
	int m_length;
	c_Stack6();
	c_Stack6* m_new();
	c_Stack6* m_new2(Array<c_IAsyncEventSource* >);
	bool p_Equals3(c_IAsyncEventSource*,c_IAsyncEventSource*);
	bool p_Contains2(c_IAsyncEventSource*);
	void p_Push16(c_IAsyncEventSource*);
	void p_Push17(Array<c_IAsyncEventSource* >,int,int);
	void p_Push18(Array<c_IAsyncEventSource* >,int);
	static c_IAsyncEventSource* m_NIL;
	void p_Length(int);
	int p_Length2();
	c_IAsyncEventSource* p_Get(int);
	void mark();
	String debug();
};
String dbg_type(c_Stack6**p){return "Stack";}
extern c_Stack6* bb_asyncevent__sources;
void bb_asyncevent_AddAsyncEventSource(c_IAsyncEventSource*);
class c_AsyncOp : public Object{
	public:
	c_AsyncOp();
	c_AsyncOp* m_new();
	virtual void p_Complete(c_Socket*)=0;
	virtual void p_Execute__UNSAFE__(c_Socket*)=0;
	void mark();
	String debug();
};
String dbg_type(c_AsyncOp**p){return "AsyncOp";}
class c_AsyncConnectOp : public c_AsyncOp{
	public:
	BBSocket* m__socket;
	String m__host;
	int m__port;
	c_IOnConnectComplete* m__onComplete;
	bool m__result;
	c_AsyncConnectOp();
	c_AsyncConnectOp* m_new(BBSocket*,String,int,c_IOnConnectComplete*);
	c_AsyncConnectOp* m_new2();
	void p_Execute__UNSAFE__(c_Socket*);
	void p_Complete(c_Socket*);
	void mark();
	String debug();
};
String dbg_type(c_AsyncConnectOp**p){return "AsyncConnectOp";}
class c_SKNCalMeshLoader : public c_CalLoader{
	public:
	c_SKNCalMeshLoader();
	c_SKNCalMeshLoader* m_new();
	Object* p_Load2(String);
	void mark();
	String debug();
};
String dbg_type(c_SKNCalMeshLoader**p){return "SKNCalMeshLoader";}
class c_SKNCalAnimationLoader : public c_CalLoader{
	public:
	c_SKNCalAnimationLoader();
	c_SKNCalAnimationLoader* m_new();
	Object* p_Load2(String);
	void mark();
	String debug();
};
String dbg_type(c_SKNCalAnimationLoader**p){return "SKNCalAnimationLoader";}
class c_SKNCalImageLoader : public c_CalLoader{
	public:
	c_SKNCalImageLoader();
	c_SKNCalImageLoader* m_new();
	Object* p_Load2(String);
	void mark();
	String debug();
};
String dbg_type(c_SKNCalImageLoader**p){return "SKNCalImageLoader";}
class c_Cal3dB3d : public Object{
	public:
	c_TMesh* m_B3dModel;
	c_List9* m_Meshes;
	c_List10* m_Anims;
	c_CalCoreModel* m_CoreModel;
	bool m_isloaded;
	c_CalCoreSkeleton* m_Skele;
	c_CalModel* m_CModel;
	c_CalRenderer* m_cal_renderer;
	c_Cal3dB3d();
	c_Cal3dB3d* m_new();
	int p_SetSkeleton(c_CalCoreSkeleton*);
	int p_AddMesh(c_CalCoreMesh*);
	int p_AddAnim(c_CalCoreAnimation*);
	int p_Build();
	int p_Update3(Float);
	void mark();
	String debug();
};
String dbg_type(c_Cal3dB3d**p){return "Cal3dB3d";}
class c_Cal3dB3dMesh : public Object{
	public:
	int m_MID;
	c_CalCoreMesh* m_CMesh;
	c_TMesh* m_B3dMesh;
	Array<c_TSurface* > m_surf;
	c_Cal3dB3dMesh();
	c_Cal3dB3dMesh* m_new();
	int p_Build2(Array<Float >,Array<int >);
	int p_Update4(int,Array<Float >,Array<int >);
	int p_Update5(int,Array<Float >,Array<Float >,Array<int >);
	void mark();
	String debug();
};
String dbg_type(c_Cal3dB3dMesh**p){return "Cal3dB3dMesh";}
class c_List9 : public Object{
	public:
	c_Node11* m__head;
	c_List9();
	c_List9* m_new();
	c_Node11* p_AddLast9(c_Cal3dB3dMesh*);
	c_List9* m_new2(Array<c_Cal3dB3dMesh* >);
	c_Enumerator14* p_ObjectEnumerator();
	void mark();
	String debug();
};
String dbg_type(c_List9**p){return "List";}
class c_Node11 : public Object{
	public:
	c_Node11* m__succ;
	c_Node11* m__pred;
	c_Cal3dB3dMesh* m__data;
	c_Node11();
	c_Node11* m_new(c_Node11*,c_Node11*,c_Cal3dB3dMesh*);
	c_Node11* m_new2();
	void mark();
	String debug();
};
String dbg_type(c_Node11**p){return "Node";}
class c_HeadNode9 : public c_Node11{
	public:
	c_HeadNode9();
	c_HeadNode9* m_new();
	void mark();
	String debug();
};
String dbg_type(c_HeadNode9**p){return "HeadNode";}
class c_CalCoreAnimation : public Object{
	public:
	Array<c_CalCoreTrack* > m_m_listCoreTrack;
	Float m_m_duration;
	Array<c_CalCallbackRecord* > m_m_listCallbacks;
	String m_m_name;
	String m_m_filename;
	c_CalCoreAnimation();
	Array<c_CalCoreTrack* > p_getListCoreTrack();
	Float p_getDuration();
	Array<c_CalCallbackRecord* > p_getCallbackList();
	c_CalCoreAnimation* m_new();
	void p_setDuration(Float);
	bool p_addCoreTrack(c_CalCoreTrack*);
	void mark();
	String debug();
};
String dbg_type(c_CalCoreAnimation**p){return "CalCoreAnimation";}
class c_List10 : public Object{
	public:
	c_Node12* m__head;
	c_List10();
	c_List10* m_new();
	c_Node12* p_AddLast10(c_CalCoreAnimation*);
	c_List10* m_new2(Array<c_CalCoreAnimation* >);
	void mark();
	String debug();
};
String dbg_type(c_List10**p){return "List";}
class c_Node12 : public Object{
	public:
	c_Node12* m__succ;
	c_Node12* m__pred;
	c_CalCoreAnimation* m__data;
	c_Node12();
	c_Node12* m_new(c_Node12*,c_Node12*,c_CalCoreAnimation*);
	c_Node12* m_new2();
	void mark();
	String debug();
};
String dbg_type(c_Node12**p){return "Node";}
class c_HeadNode10 : public c_Node12{
	public:
	c_HeadNode10();
	c_HeadNode10* m_new();
	void mark();
	String debug();
};
String dbg_type(c_HeadNode10**p){return "HeadNode";}
class c_CalCoreModel : public Object{
	public:
	String m_m_name;
	c_CalCoreSkeleton* m_m_coreSkeleton;
	Array<c_CalCoreAnimation* > m_m_vectorCoreAnimation;
	Array<c_CalCoreMorphAnimation* > m_m_vectorCoreMorphAnimation;
	Array<c_CalCoreMesh* > m_m_vectorCoreMesh;
	Array<c_CalCoreMaterial* > m_m_vectorCoreMaterial;
	c_IntMap3* m_m_mapmapCoreMaterialThread;
	c_StringMap* m_m_animationName;
	c_StringMap* m_m_materialName;
	c_StringMap* m_m_meshName;
	c_CalCoreModel();
	c_CalCoreModel* m_new(String);
	void p_setCoreSkeleton(c_CalCoreSkeleton*);
	int p_addCoreMesh(c_CalCoreMesh*);
	int p_addCoreAnimation(c_CalCoreAnimation*);
	c_CalCoreSkeleton* p_getCoreSkeleton();
	int p_getCoreMeshCount();
	c_CalCoreMesh* p_getCoreMesh(int);
	int p_getCoreAnimationCount();
	int p_getCoreMorphAnimationCount();
	c_CalModel* p_makemodel();
	c_CalCoreAnimation* p_getCoreAnimation(int);
	c_CalCoreMorphAnimation* p_getCoreMorphAnimation(int);
	void mark();
	String debug();
};
String dbg_type(c_CalCoreModel**p){return "CalCoreModel";}
class c_CalCoreSkeleton : public Object{
	public:
	Array<c_CalCoreBone* > m_m_vectorCoreBone;
	c_StringMap* m_m_mapCoreBoneNames;
	Array<int > m_m_vectorRootCoreBoneId;
	c_CalCoreSkeleton();
	int p_getCoreBoneId(String);
	void p_calculateBoundingBoxes(c_CalCoreModel*);
	Array<c_CalCoreBone* > p_getVectorCoreBone();
	Array<int > p_getVectorRootCoreBoneId();
	c_CalCoreSkeleton* m_new();
	bool p_mapCoreBoneName(int,String);
	int p_addCoreBone(c_CalCoreBone*);
	c_CalCoreBone* p_getCoreBone(int);
	c_CalCoreBone* p_getCoreBone2(String);
	void p_calculateState();
	void mark();
	String debug();
};
String dbg_type(c_CalCoreSkeleton**p){return "CalCoreSkeleton";}
class c_CalCoreMorphAnimation : public Object{
	public:
	Array<int > m_m_vectorCoreMeshID;
	Array<int > m_m_vectorMorphTargetID;
	c_CalCoreMorphAnimation();
	Array<int > p_getVectorCoreMeshID();
	Array<int > p_getVectorMorphTargetID();
	void mark();
	String debug();
};
String dbg_type(c_CalCoreMorphAnimation**p){return "CalCoreMorphAnimation";}
class c_CalCoreMesh : public Object{
	public:
	Array<c_CalCoreSubmesh* > m_m_vectorCoreSubmesh;
	c_CalCoreMesh();
	int p_getCoreSubmeshCount();
	c_CalCoreSubmesh* p_getCoreSubmesh(int);
	Array<c_CalCoreSubmesh* > p_getVectorCoreSubmesh();
	c_CalCoreMesh* m_new();
	int p_addCoreSubmesh(c_CalCoreSubmesh*);
	void mark();
	String debug();
};
String dbg_type(c_CalCoreMesh**p){return "CalCoreMesh";}
class c_CalCoreMaterial : public Object{
	public:
	c_CalCoreMaterial();
	void mark();
	String debug();
};
String dbg_type(c_CalCoreMaterial**p){return "CalCoreMaterial";}
class c_Map2 : public Object{
	public:
	c_Map2();
	void mark();
	String debug();
};
String dbg_type(c_Map2**p){return "Map";}
class c_IntMap2 : public c_Map2{
	public:
	c_IntMap2();
	void mark();
	String debug();
};
String dbg_type(c_IntMap2**p){return "IntMap";}
class c_Map3 : public Object{
	public:
	c_Map3();
	c_Map3* m_new();
	void mark();
	String debug();
};
String dbg_type(c_Map3**p){return "Map";}
class c_IntMap3 : public c_Map3{
	public:
	c_IntMap3();
	c_IntMap3* m_new();
	void mark();
	String debug();
};
String dbg_type(c_IntMap3**p){return "IntMap";}
class c_Map4 : public Object{
	public:
	c_Node14* m_root;
	c_Map4();
	c_Map4* m_new();
	virtual int p_Compare3(String,String)=0;
	c_Node14* p_FindNode2(String);
	bool p_Contains3(String);
	int p_Get2(String);
	int p_RotateLeft2(c_Node14*);
	int p_RotateRight2(c_Node14*);
	int p_InsertFixup2(c_Node14*);
	bool p_Add3(String,int);
	void mark();
	String debug();
};
String dbg_type(c_Map4**p){return "Map";}
class c_StringMap : public c_Map4{
	public:
	c_StringMap();
	c_StringMap* m_new();
	int p_Compare3(String,String);
	void mark();
	String debug();
};
String dbg_type(c_StringMap**p){return "StringMap";}
class c_DeltaTimer : public Object{
	public:
	Float m_targetfps;
	Float m_lastticks;
	Float m_delta;
	Float m_currentticks;
	Float m_frametime;
	c_DeltaTimer();
	c_DeltaTimer* m_new(Float);
	c_DeltaTimer* m_new2();
	void p_UpdateDelta();
	void mark();
	String debug();
};
String dbg_type(c_DeltaTimer**p){return "DeltaTimer";}
c_TCamera* bb_functions_CreateCamera(c_TEntity*);
class c_TBone : public c_TEntity{
	public:
	c_Matrix* m_rest_mat;
	c_Matrix* m_mat2;
	c_Matrix* m_tform_mat;
	c_Matrix* m_inv_mat;
	c_TBone();
	static c_Matrix* m_t_mat;
	static c_Matrix* m_new_mat;
	void p_UpdateMatrix(c_Matrix*);
	static void m_UpdateNonBoneChild(c_TEntity*);
	static void m_UpdateBoneChildren(c_TEntity*);
	int p_PositionBone(Float,Float,Float,int);
	int p_RotateBone(Float,Float,Float,int);
	int p_ScaleBone(Float,Float,Float,int);
	void mark();
	String debug();
};
String dbg_type(c_TBone**p){return "TBone";}
class c_Line : public Object{
	public:
	c_Vector* m_o;
	c_Vector* m_d;
	c_Line();
	c_Line* m_new();
	c_Line* m_new2(c_Vector*,c_Vector*);
	c_Line* m_new3(Float,Float,Float,Float,Float,Float);
	void mark();
	String debug();
};
String dbg_type(c_Line**p){return "Line";}
c_TLight* bb_functions_CreateLight(int,c_TEntity*);
c_TMesh* bb_functions_CreateCube(c_TEntity*);
class c_TText : public c_TSprite{
	public:
	String m_text;
	int m_length;
	c_TCamera* m_cam;
	Float m_char_pixels;
	String m_font_file;
	Float m_orig_width;
	Float m_orig_height;
	c_TSurface* m_surf;
	int m_char_rows;
	Float m_pixel_ratio;
	Float m_char_uvwidth;
	int m_padding;
	bool m_mode;
	String m_old_text;
	c_TText();
	c_TText* m_new();
	static int m_mask_color;
	int p_AddChar(int,int,Float,Float,Float);
	int p_AdjustChar(int,int,Float,Float);
	int p_SetText(String,Float,Float,Float,int);
	static c_TText* m_CreateText(c_TCamera*,String,String,int,int,Float,bool);
	static c_TText* m_CreateText2D(c_TCamera*,String,String,int,int,int);
	void mark();
	String debug();
};
String dbg_type(c_TText**p){return "TText";}
class c_IPixmapManager : public virtual gc_interface{
	public:
	virtual c_TPixmap* p_LoadPixmap(String)=0;
	virtual c_TPixmap* p_CreatePixmap(int,int,int)=0;
};
class c_TTextureFilter : public Object{
	public:
	String m_text;
	int m_flags;
	c_TTextureFilter();
	static c_List11* m_filter_list;
	c_TTextureFilter* m_new();
	void mark();
	String debug();
};
String dbg_type(c_TTextureFilter**p){return "TTextureFilter";}
class c_List11 : public Object{
	public:
	c_Node13* m__head;
	c_List11();
	c_List11* m_new();
	c_Node13* p_AddLast11(c_TTextureFilter*);
	c_List11* m_new2(Array<c_TTextureFilter* >);
	c_Enumerator11* p_ObjectEnumerator();
	void mark();
	String debug();
};
String dbg_type(c_List11**p){return "List";}
class c_Node13 : public Object{
	public:
	c_Node13* m__succ;
	c_Node13* m__pred;
	c_TTextureFilter* m__data;
	c_Node13();
	c_Node13* m_new(c_Node13*,c_Node13*,c_TTextureFilter*);
	c_Node13* m_new2();
	void mark();
	String debug();
};
String dbg_type(c_Node13**p){return "Node";}
class c_HeadNode11 : public c_Node13{
	public:
	c_HeadNode11();
	c_HeadNode11* m_new();
	void mark();
	String debug();
};
String dbg_type(c_HeadNode11**p){return "HeadNode";}
class c_Enumerator11 : public Object{
	public:
	c_List11* m__list;
	c_Node13* m__curr;
	c_Enumerator11();
	c_Enumerator11* m_new(c_List11*);
	c_Enumerator11* m_new2();
	bool p_HasNext();
	c_TTextureFilter* p_NextObject();
	void mark();
	String debug();
};
String dbg_type(c_Enumerator11**p){return "Enumerator";}
class c_List12 : public Object{
	public:
	c_Node6* m__head;
	c_List12();
	c_List12* m_new();
	c_Node6* p_AddLast12(c_TTexture*);
	c_List12* m_new2(Array<c_TTexture* >);
	c_Enumerator12* p_ObjectEnumerator();
	void mark();
	String debug();
};
String dbg_type(c_List12**p){return "List";}
class c_HeadNode12 : public c_Node6{
	public:
	c_HeadNode12();
	c_HeadNode12* m_new();
	void mark();
	String debug();
};
String dbg_type(c_HeadNode12**p){return "HeadNode";}
class c_Enumerator12 : public Object{
	public:
	c_List12* m__list;
	c_Node6* m__curr;
	c_Enumerator12();
	c_Enumerator12* m_new(c_List12*);
	c_Enumerator12* m_new2();
	bool p_HasNext();
	c_TTexture* p_NextObject();
	void mark();
	String debug();
};
String dbg_type(c_Enumerator12**p){return "Enumerator";}
int bb_input_KeyHit(int);
class c_Enumerator13 : public Object{
	public:
	c_List8* m__list;
	c_Node10* m__curr;
	c_Enumerator13();
	c_Enumerator13* m_new(c_List8*);
	c_Enumerator13* m_new2();
	bool p_HasNext();
	c_CalLoadingCallback* p_NextObject();
	void mark();
	String debug();
};
String dbg_type(c_Enumerator13**p){return "Enumerator";}
class c_CalCoreBone : public Object{
	public:
	String m_m_name;
	c_CalCoreSkeleton* m_m_coreSkeleton;
	c_CalQuaternion* m_m_rotationBoneSpace;
	c_CalBoundingBox* m_m_boundingBox;
	Array<c_CalVector* > m_m_boundingPosition;
	c_CalVector* m_m_translation;
	bool m_m_boundingBoxPrecomputed;
	c_CalQuaternion* m_m_rotation;
	int m_m_parentId;
	c_CalVector* m_m_translationBoneSpace;
	Array<int > m_m_listChildId;
	c_CalVector* m_m_translationAbsolute;
	c_CalQuaternion* m_m_rotationAbsolute;
	Object* m_m_userData;
	c_CalCoreBone();
	void p_calculateBoundingBox(c_CalCoreModel*);
	c_CalVector* p_getTranslation();
	c_CalQuaternion* p_getRotation();
	int p_getParentId();
	c_CalVector* p_getTranslationBoneSpace();
	c_CalQuaternion* p_getRotationBoneSpace();
	Array<int > p_getListChildId();
	c_CalCoreBone* m_new(String);
	void p_setParentId(int);
	void p_setTranslation(c_CalVector*);
	void p_setRotation(c_CalQuaternion*);
	void p_setTranslationBoneSpace(c_CalVector*);
	void p_setRotationBoneSpace(c_CalQuaternion*);
	bool p_addChildId(int);
	void p_setCoreSkeleton(c_CalCoreSkeleton*);
	String p_getName();
	c_CalQuaternion* p_getRotationAbsolute();
	c_CalVector* p_getTranslationAbsolute();
	void p_calculateState();
	void mark();
	String debug();
};
String dbg_type(c_CalCoreBone**p){return "CalCoreBone";}
class c_Node14 : public Object{
	public:
	String m_key;
	c_Node14* m_right;
	c_Node14* m_left;
	int m_value;
	int m_color;
	c_Node14* m_parent;
	c_Node14();
	c_Node14* m_new(String,int,int,c_Node14*);
	c_Node14* m_new2();
	void mark();
	String debug();
};
String dbg_type(c_Node14**p){return "Node";}
class c_CalQuaternion : public Object{
	public:
	Float m_x;
	Float m_y;
	Float m_z;
	Float m_w;
	c_CalQuaternion();
	c_CalQuaternion* m_new();
	c_CalQuaternion* m_new2(c_CalQuaternion*);
	c_CalQuaternion* m_new3(Float,Float,Float,Float);
	void p_conjugate();
	void p_invert();
	c_CalQuaternion* p_multVectorLocal(c_CalVector*);
	c_CalQuaternion* p_multQuaternionLocal(c_CalQuaternion*);
	void p_assign(c_CalQuaternion*);
	void p_blend(Float,c_CalQuaternion*);
	void mark();
	String debug();
};
String dbg_type(c_CalQuaternion**p){return "CalQuaternion";}
class c_CalVector : public Object{
	public:
	Float m_x;
	Float m_y;
	Float m_z;
	c_CalVector();
	c_CalVector* m_new();
	c_CalVector* m_new2(c_CalVector*);
	c_CalVector* m_new3(Float,Float,Float);
	c_CalVector* p_multQuaternionLocal(c_CalQuaternion*);
	void p_assign2(c_CalVertex*);
	void p_assign3(Float,Float,Float);
	void p_assign4(c_CalVector*);
	c_CalVector* p_multMatrixLocal(c_CalMatrix*);
	c_CalVector* p_addLocal(c_CalVector*);
	void p_blend2(Float,c_CalVector*);
	c_CalVector* p_multScalarLocal(Float);
	Float p_normalize();
	c_CalVector* p_subLocal(c_CalVector*);
	void p_clear();
	Float p_length();
	void mark();
	String debug();
};
String dbg_type(c_CalVector**p){return "CalVector";}
class c_CalBoundingBox : public Object{
	public:
	Array<c_CalPlane* > m_plane;
	c_CalBoundingBox();
	c_CalBoundingBox* m_new();
	void mark();
	String debug();
};
String dbg_type(c_CalBoundingBox**p){return "CalBoundingBox";}
class c_CalPlane : public Object{
	public:
	Float m_a;
	Float m_b;
	Float m_c;
	Float m_d;
	c_CalPlane();
	void p_setNormal(c_CalVector*);
	Float p_eval(c_CalVector*);
	void p_setPosition(c_CalVector*);
	c_CalPlane* m_new();
	Float p_dist(c_CalVector*);
	void mark();
	String debug();
};
String dbg_type(c_CalPlane**p){return "CalPlane";}
class c_CalVertex : public Object{
	public:
	c_CalVector* m_position;
	Array<c_CalInfluence* > m_vectorInfluence;
	int m_faceCollapseCount;
	int m_collapseId;
	c_CalVector* m_normal;
	c_CalVertex();
	c_CalVertex* m_new();
	c_CalVertex* m_new2(c_CalVector*);
	c_CalVertex* m_new3(c_CalVector*,c_CalVector*);
	c_CalVertex* m_new4(c_CalVector*,c_CalVector*,Array<c_CalInfluence* >,int,int);
	void mark();
	String debug();
};
String dbg_type(c_CalVertex**p){return "CalVertex";}
class c_CalCoreSubmesh : public Object{
	public:
	Array<c_CalSpring* > m_m_vectorSpring;
	Array<c_CalVertex* > m_m_vectorVertex;
	Array<c_CalCoreSubMorphTarget* > m_m_vectorCoreSubMorphTarget;
	Array<c_CalFace* > m_m_vectorFace;
	int m_m_lodCount;
	Array<Array<c_CalTangentSpace* > > m_m_vectorvectorTangentSpace;
	Array<c_CalPhysicalProperty* > m_m_vectorPhysicalProperty;
	Array<bool > m_m_vectorTangentsEnabled;
	Array<Array<c_CalTextureCoordinate* > > m_m_vectorvectorTextureCoordinate;
	int m_m_coreMaterialThreadId;
	c_CalCoreSubmesh();
	int p_getSpringCount();
	Array<c_CalVertex* > p_getVectorVertex();
	int p_getCoreSubMorphTargetCount();
	int p_getFaceCount();
	int p_getLodCount();
	int p_getVertexCount();
	Array<c_CalFace* > p_getVectorFace();
	Array<Array<c_CalTangentSpace* > > p_getVectorVectorTangentSpace();
	Array<c_CalPhysicalProperty* > p_getVectorPhysicalProperty();
	Array<c_CalCoreSubMorphTarget* > p_getVectorCoreSubMorphTarget();
	bool p_isTangentsEnabled(int);
	Array<c_CalSpring* > p_getVectorSpring();
	Array<Array<c_CalTextureCoordinate* > > p_getVectorVectorTextureCoordinate();
	c_CalCoreSubmesh* m_new();
	void p_setLodCount(int);
	void p_setCoreMaterialThreadId(int);
	bool p_reserve(int,int,int,int);
	bool p_setTextureCoordinate(int,int,c_CalTextureCoordinate*);
	bool p_setVertex(int,c_CalVertex*);
	bool p_setFace(int,c_CalFace*);
	void mark();
	String debug();
};
String dbg_type(c_CalCoreSubmesh**p){return "CalCoreSubmesh";}
class c_CalSpring : public Object{
	public:
	Array<int > m_vertexId;
	Float m_idleLength;
	c_CalSpring();
	void mark();
	String debug();
};
String dbg_type(c_CalSpring**p){return "CalSpring";}
class c_CalInfluence : public Object{
	public:
	int m_boneId;
	Float m_weight;
	c_CalInfluence();
	c_CalInfluence* m_new();
	c_CalInfluence* m_new2(int,Float);
	void mark();
	String debug();
};
String dbg_type(c_CalInfluence**p){return "CalInfluence";}
class c_CalModel : public Object{
	public:
	c_CalCoreModel* m_m_coreModel;
	c_CalSkeleton* m_m_skeleton;
	c_CalMixer* m_m_mixer;
	c_CalMorphTargetMixer* m_m_morphTargetMixer;
	c_CalPhysique* m_m_physique;
	c_CalSpringSystem* m_m_springSystem;
	c_CalRenderer* m_m_renderer;
	Object* m_m_userData;
	Array<c_CalMesh* > m_m_vectorMesh;
	c_CalBoundingBox* m_m_boundingBox;
	c_CalModel();
	c_CalCoreModel* p_getCoreModel();
	c_CalModel* m_new();
	c_CalModel* m_new2(c_CalCoreModel*);
	bool p_attachMesh(int);
	c_CalRenderer* p_getRenderer();
	Array<c_CalMesh* > p_getVectorMesh();
	c_CalPhysique* p_getPhysique();
	c_CalSkeleton* p_getSkeleton();
	c_CalMixer* p_getMixer();
	Object* p_getUserData();
	c_CalMesh* p_getMesh(int);
	void p_update(Float);
	void mark();
	String debug();
};
String dbg_type(c_CalModel**p){return "CalModel";}
class c_CalSkeleton : public Object{
	public:
	c_CalCoreSkeleton* m_m_coreSkeleton;
	Array<c_CalBone* > m_m_vectorBone;
	bool m_m_isBoundingBoxesComputed;
	c_CalSkeleton();
	c_CalSkeleton* m_new();
	c_CalSkeleton* m_new2(c_CalCoreSkeleton*);
	Array<c_CalBone* > p_getVectorBone();
	void p_clearState();
	void p_lockState();
	c_CalBone* p_getBone(int);
	void p_calculateState();
	void mark();
	String debug();
};
String dbg_type(c_CalSkeleton**p){return "CalSkeleton";}
class c_CalAbstractMixer : public Object{
	public:
	c_CalAbstractMixer();
	c_CalAbstractMixer* m_new();
	c_CalAbstractMixer* m_new2(c_CalModel*);
	virtual bool p_isDefaultMixer();
	virtual void p_updateAnimation(Float);
	virtual void p_updateSkeleton();
	void mark();
	String debug();
};
String dbg_type(c_CalAbstractMixer**p){return "CalAbstractMixer";}
class c_CalMixer : public c_CalAbstractMixer{
	public:
	c_CalModel* m_m_model;
	Array<c_CalAnimation* > m_m_vectorAnimation;
	Array<c_CalAnimationAction* > m_m_listAnimationAction;
	Array<c_CalAnimationCycle* > m_m_listAnimationCycle;
	Float m_m_animationTime;
	Float m_m_animationDuration;
	Float m_m_timeFactor;
	c_CalMixer();
	c_CalMixer* m_new(c_CalModel*);
	c_CalMixer* m_new2();
	bool p_isDefaultMixer();
	bool p_blendCycle(int,Float,Float);
	void p_updateAnimation(Float);
	void p_updateSkeleton();
	void mark();
	String debug();
};
String dbg_type(c_CalMixer**p){return "CalMixer";}
class c_CalAnimation : public Object{
	public:
	c_CalCoreAnimation* m_m_coreAnimation;
	Array<Float > m_m_lastCallbackTimes;
	int m_m_type;
	int m_m_state;
	Float m_m_time;
	Float m_m_timeFactor;
	Float m_m_weight;
	c_CalAnimation();
	c_CalAnimation* m_new();
	c_CalAnimation* m_new2(c_CalCoreAnimation*);
	void p_setType(int);
	void p_setState(int);
	void p_setWeight(Float);
	int p_getType();
	void p_checkCallbacks(Float,c_CalModel*);
	int p_getState();
	Float p_getTime();
	Float p_getTimeFactor();
	void p_setTime(Float);
	c_CalCoreAnimation* p_getCoreAnimation2();
	void p_completeCallbacks(c_CalModel*);
	Float p_getWeight();
	void mark();
	String debug();
};
String dbg_type(c_CalAnimation**p){return "CalAnimation";}
class c_CalAnimationAction : public c_CalAnimation{
	public:
	Float m_m_delayIn;
	Float m_m_weightTarget;
	bool m_m_autoLock;
	Float m_m_delayOut;
	c_CalAnimationAction();
	bool p_update(Float);
	void mark();
	String debug();
};
String dbg_type(c_CalAnimationAction**p){return "CalAnimationAction";}
class c_CalAnimationCycle : public c_CalAnimation{
	public:
	Float m_m_targetDelay;
	Float m_m_targetWeight;
	c_CalAnimationCycle();
	c_CalAnimationCycle* m_new();
	c_CalAnimationCycle* m_new2(c_CalCoreAnimation*);
	bool p_blend3(Float,Float);
	bool p_update(Float);
	void mark();
	String debug();
};
String dbg_type(c_CalAnimationCycle**p){return "CalAnimationCycle";}
class c_CalMorphTargetMixer : public Object{
	public:
	c_CalModel* m_m_model;
	Array<Float > m_m_vectorCurrentWeight;
	Array<Float > m_m_vectorEndWeight;
	Array<Float > m_m_vectorDuration;
	c_CalMorphTargetMixer();
	c_CalMorphTargetMixer* m_new();
	c_CalMorphTargetMixer* m_new2(c_CalModel*);
	void p_update(Float);
	void mark();
	String debug();
};
String dbg_type(c_CalMorphTargetMixer**p){return "CalMorphTargetMixer";}
class c_CalPhysique : public Object{
	public:
	c_CalModel* m_m_model;
	bool m_m_normalize;
	Float m_m_axisFactorX;
	Float m_m_axisFactorY;
	Float m_m_axisFactorZ;
	c_CalPhysique();
	c_CalPhysique* m_new();
	c_CalPhysique* m_new2(c_CalModel*);
	int p_calculateVertices(c_CalSubmesh*,Array<Float >,int);
	int p_calculateVerticesAndNormalsInternal(c_CalSubmesh*,Array<c_CalVector* >,Array<c_CalVector* >);
	int p_calculateTangentSpacesInternal(c_CalSubmesh*,int,Array<c_CalTangentSpace* >);
	void p_update2();
	int p_calculateVerticesNormalsAndTexCoords(c_CalSubmesh*,Array<Float >,int);
	void mark();
	String debug();
};
String dbg_type(c_CalPhysique**p){return "CalPhysique";}
class c_CalSpringSystem : public Object{
	public:
	c_CalModel* m_m_model;
	c_CalVector* m_m_gravity;
	c_CalVector* m_m_force;
	bool m_m_collision;
	c_CalSpringSystem();
	c_CalSpringSystem* m_new();
	c_CalSpringSystem* m_new2(c_CalModel*);
	void p_calculateForces(c_CalSubmesh*,Float);
	void p_calculateVertices2(c_CalSubmesh*,Float);
	void p_update(Float);
	void mark();
	String debug();
};
String dbg_type(c_CalSpringSystem**p){return "CalSpringSystem";}
class c_CalRenderer : public Object{
	public:
	c_CalModel* m_m_model;
	c_CalSubmesh* m_m_selectedSubmesh;
	c_CalRenderer();
	c_CalRenderer* m_new();
	c_CalRenderer* m_new2(c_CalModel*);
	c_CalRenderer* m_new3(c_CalRenderer*);
	bool p_beginRendering();
	int p_getMeshCount();
	int p_getSubmeshCount(int);
	bool p_selectMeshSubmesh(int,int);
	int p_getVertexCount();
	int p_getFaceCount();
	int p_getVertices(Array<Float >,int);
	int p_getFaces(Array<int >);
	void p_endRendering();
	int p_getVerticesNormalsAndTexCoords(Array<Float >,int);
	void mark();
	String debug();
};
String dbg_type(c_CalRenderer**p){return "CalRenderer";}
class c_CalSubmesh : public Object{
	public:
	c_CalCoreSubmesh* m_m_coreSubmesh;
	Array<Float > m_m_vectorMorphTargetWeight;
	Array<c_CalVector* > m_m_vectorVertex;
	Array<c_CalVector* > m_m_vectorNormal;
	Array<Array<c_CalTangentSpace* > > m_m_vectorvectorTangentSpace;
	Array<c_CalFace* > m_m_vectorFace;
	Array<c_CalPhysicalProperty* > m_m_vectorPhysicalProperty;
	int m_m_vertexCount;
	int m_m_faceCount;
	int m_m_coreMaterialId;
	bool m_m_bInternalData;
	c_CalSubmesh();
	c_CalSubmesh* m_new();
	void p_setLodLevel(Float);
	c_CalSubmesh* m_new2(c_CalCoreSubmesh*);
	int p_getVertexCount();
	int p_getFaceCount();
	bool p_hasInternalData();
	Array<c_CalVector* > p_getVectorVertex();
	c_CalCoreSubmesh* p_getCoreSubmesh2();
	int p_getMorphTargetWeightCount();
	Float p_getBaseWeight();
	Float p_getMorphTargetWeight(int);
	int p_getFaces(Array<int >);
	void p_setMorphTargetWeight(int,Float);
	Array<c_CalVector* > p_getVectorNormal();
	Array<Array<c_CalTangentSpace* > > p_getVectorVectorTangentSpace();
	bool p_isTangentsEnabled(int);
	Array<c_CalPhysicalProperty* > p_getVectorPhysicalProperty();
	void mark();
	String debug();
};
String dbg_type(c_CalSubmesh**p){return "CalSubmesh";}
class c_CalMesh : public Object{
	public:
	c_CalCoreMesh* m_m_coreMesh;
	c_CalModel* m_m_model;
	Array<c_CalSubmesh* > m_m_vectorSubmesh;
	c_CalMesh();
	c_CalCoreMesh* p_getCoreMesh2();
	c_CalMesh* m_new();
	c_CalMesh* m_new2(c_CalCoreMesh*);
	void p_setModel(c_CalModel*);
	c_CalSubmesh* p_getSubmesh(int);
	int p_getSubmeshCount2();
	Array<c_CalSubmesh* > p_getVectorSubmesh();
	void mark();
	String debug();
};
String dbg_type(c_CalMesh**p){return "CalMesh";}
class c_CalBone : public Object{
	public:
	c_CalCoreBone* m_m_coreBone;
	c_CalSkeleton* m_m_skeleton;
	Float m_m_accumulatedWeight;
	Float m_m_accumulatedWeightAbsolute;
	c_CalVector* m_m_translation;
	c_CalQuaternion* m_m_rotation;
	c_CalVector* m_m_translationAbsolute;
	c_CalQuaternion* m_m_rotationAbsolute;
	c_CalVector* m_m_translationBoneSpace;
	c_CalQuaternion* m_m_rotationBoneSpace;
	c_CalMatrix* m_m_transformMatrix;
	c_CalBoundingBox* m_m_boundingBox;
	c_CalBone();
	c_CalBone* m_new();
	void p_clearState();
	c_CalBone* m_new2(c_CalCoreBone*);
	void p_setSkeleton(c_CalSkeleton*);
	c_CalMatrix* p_getTransformMatrix();
	c_CalVector* p_getTranslationBoneSpace();
	void p_blendState(Float,c_CalVector*,c_CalQuaternion*);
	void p_lockState();
	c_CalQuaternion* p_getRotationAbsolute();
	c_CalVector* p_getTranslationAbsolute();
	void p_calculateState();
	c_CalBoundingBox* p_getBoundingBox();
	void mark();
	String debug();
};
String dbg_type(c_CalBone**p){return "CalBone";}
class c_CalMatrix : public Object{
	public:
	Float m_dxdx;
	Float m_dydx;
	Float m_dzdx;
	Float m_dxdy;
	Float m_dydy;
	Float m_dzdy;
	Float m_dxdz;
	Float m_dydz;
	Float m_dzdz;
	c_CalMatrix();
	c_CalMatrix* m_new();
	c_CalMatrix* m_new2(c_CalMatrix*);
	int p_assign(c_CalQuaternion*);
	void mark();
	String debug();
};
String dbg_type(c_CalMatrix**p){return "CalMatrix";}
class c_Enumerator14 : public Object{
	public:
	c_List9* m__list;
	c_Node11* m__curr;
	c_Enumerator14();
	c_Enumerator14* m_new(c_List9*);
	c_Enumerator14* m_new2();
	bool p_HasNext();
	c_Cal3dB3dMesh* p_NextObject();
	void mark();
	String debug();
};
String dbg_type(c_Enumerator14**p){return "Enumerator";}
class c_CalTangentSpace : public Object{
	public:
	c_CalVector* m_tangent;
	Float m_crossFactor;
	c_CalTangentSpace();
	c_CalTangentSpace* m_new();
	c_CalTangentSpace* m_new2(c_CalVector*,Float);
	c_CalTangentSpace* m_new3(Float,Float,Float,Float);
	void mark();
	String debug();
};
String dbg_type(c_CalTangentSpace**p){return "CalTangentSpace";}
class c_CalFace : public Object{
	public:
	Array<int > m_vertexId;
	c_CalFace();
	c_CalFace* m_new();
	c_CalFace* m_new2(int,int,int);
	c_CalFace* m_new3(c_CalFace*);
	c_CalFace* m_new4(Array<int >);
	void mark();
	String debug();
};
String dbg_type(c_CalFace**p){return "CalFace";}
class c_CalPhysicalProperty : public Object{
	public:
	Float m_weight;
	c_CalVector* m_position;
	c_CalVector* m_positionOld;
	c_CalVector* m_force;
	c_CalPhysicalProperty();
	c_CalPhysicalProperty* m_new();
	c_CalPhysicalProperty* m_new2(Float);
	c_CalPhysicalProperty* m_new3(c_CalVector*,c_CalVector*,c_CalVector*,Float);
	void mark();
	String debug();
};
String dbg_type(c_CalPhysicalProperty**p){return "CalPhysicalProperty";}
class c_CalCoreSubMorphTarget : public Object{
	public:
	Array<c_CalBlendVertex* > m_m_vectorBlendVertex;
	c_CalCoreSubMorphTarget();
	Array<c_CalBlendVertex* > p_getVectorBlendVertex();
	void mark();
	String debug();
};
String dbg_type(c_CalCoreSubMorphTarget**p){return "CalCoreSubMorphTarget";}
class c_CalBlendVertex : public Object{
	public:
	c_CalVector* m_position;
	c_CalVector* m_normal;
	c_CalBlendVertex();
	void mark();
	String debug();
};
String dbg_type(c_CalBlendVertex**p){return "CalBlendVertex";}
class c_NormHelperClass : public Object{
	public:
	c_Vector* m_vec;
	int m_vert;
	c_NormHelperClass();
	c_NormHelperClass* m_new();
	void mark();
	String debug();
};
String dbg_type(c_NormHelperClass**p){return "NormHelperClass";}
class c_Map5 : public Object{
	public:
	c_Node15* m_root;
	c_Map5();
	c_Map5* m_new();
	virtual int p_Compare4(c_Vector*,c_Vector*)=0;
	c_Node15* p_FindNode3(c_Vector*);
	c_NormHelperClass* p_Get3(c_Vector*);
	int p_RotateLeft3(c_Node15*);
	int p_RotateRight3(c_Node15*);
	int p_InsertFixup3(c_Node15*);
	bool p_Set3(c_Vector*,c_NormHelperClass*);
	void mark();
	String debug();
};
String dbg_type(c_Map5**p){return "Map";}
class c_NormMap : public c_Map5{
	public:
	c_NormMap();
	c_NormMap* m_new();
	int p_Compare4(c_Vector*,c_Vector*);
	void mark();
	String debug();
};
String dbg_type(c_NormMap**p){return "NormMap";}
class c_Node15 : public Object{
	public:
	c_Vector* m_key;
	c_Node15* m_right;
	c_Node15* m_left;
	c_NormHelperClass* m_value;
	int m_color;
	c_Node15* m_parent;
	c_Node15();
	c_Node15* m_new(c_Vector*,c_NormHelperClass*,int,c_Node15*);
	c_Node15* m_new2();
	void mark();
	String debug();
};
String dbg_type(c_Node15**p){return "Node";}
class c_CalCoreTrack : public Object{
	public:
	Array<c_CalCoreKeyframe* > m_m_keyframes;
	int m_m_coreBoneId;
	c_CalCoreTrack();
	int p_getCoreKeyframeCount();
	c_CalCoreKeyframe* p_getCoreKeyframe(int);
	bool p_addCoreKeyframe(c_CalCoreKeyframe*);
	int p_getCoreBoneId2();
	int p_getUpperBound(Float);
	bool p_getState2(Float,c_CalVector*,c_CalQuaternion*);
	c_CalCoreTrack* m_new();
	bool p_setCoreBoneId(int);
	void mark();
	String debug();
};
String dbg_type(c_CalCoreTrack**p){return "CalCoreTrack";}
class c_CalCoreKeyframe : public Object{
	public:
	Float m_m_time;
	c_CalVector* m_m_translation;
	c_CalQuaternion* m_m_rotation;
	c_CalCoreKeyframe();
	Float p_getTime();
	c_CalCoreKeyframe* m_new();
	c_CalCoreKeyframe* m_new2(Float,c_CalVector*,c_CalQuaternion*);
	c_CalVector* p_getTranslation();
	void p_setTranslation(c_CalVector*);
	c_CalQuaternion* p_getRotation();
	void p_setRotation(c_CalQuaternion*);
	void p_setTime(Float);
	void mark();
	String debug();
};
String dbg_type(c_CalCoreKeyframe**p){return "CalCoreKeyframe";}
void bb_mixer_addExtraKeyframeForLoopedAnim(c_CalCoreAnimation*);
class c_CalCallbackRecord : public Object{
	public:
	c_CalAnimationCallback* m_callback;
	Float m_min_interval;
	c_CalCallbackRecord();
	void mark();
	String debug();
};
String dbg_type(c_CalCallbackRecord**p){return "CalCallbackRecord";}
class c_CalAnimationType : public Object{
	public:
	c_CalAnimationType();
	void mark();
	String debug();
};
String dbg_type(c_CalAnimationType**p){return "CalAnimationType";}
class c_CalAnimationState : public Object{
	public:
	c_CalAnimationState();
	void mark();
	String debug();
};
String dbg_type(c_CalAnimationState**p){return "CalAnimationState";}
class c_CalAnimationCallback : public c_CalCallbackRecord{
	public:
	c_CalAnimationCallback();
	void p_AnimationUpdate(Float,c_CalModel*,Object*);
	void p_AnimationComplete(c_CalModel*,Object*);
	void mark();
	String debug();
};
String dbg_type(c_CalAnimationCallback**p){return "CalAnimationCallback";}
Float bb_animation_Modf(Float,Float);
c_CalVector* bb_math_vectorScalarMult(c_CalVector*,Float);
c_CalVector* bb_math_vectorSub(c_CalVector*,c_CalVector*);
c_CalVector* bb_math_vectorSub2(c_CalVertex*,c_CalVertex*);
class c_CalTextureCoordinate : public Object{
	public:
	Float m_u;
	Float m_v;
	c_CalTextureCoordinate();
	c_CalTextureCoordinate* m_new();
	c_CalTextureCoordinate* m_new2(c_CalTextureCoordinate*);
	c_CalTextureCoordinate* m_new3(Float,Float);
	void mark();
	String debug();
};
String dbg_type(c_CalTextureCoordinate**p){return "CalTextureCoordinate";}
class c_CalImage : public Object{
	public:
	bool m_finished;
	int m_pos;
	Array<String > m_pixels;
	int m_posx;
	int m_posy;
	c_TPixmap* m_tex;
	int m_w;
	int m_h;
	c_TTexture* m_texture;
	c_CalImage();
	bool p_IsFinished();
	c_TTexture* p_MakeTexture();
	void p_Update();
	c_CalImage* m_new();
	c_CalImage* m_new2(int,int,Array<String >);
	void mark();
	String debug();
};
String dbg_type(c_CalImage**p){return "CalImage";}
Array<int > bb_calimage_IntToRGBA(int);
int bb_functions_EntityTexture(c_TEntity*,c_TTexture*,int,int);
extern c_IAsyncEventSource* bb_asyncevent__current;
int bb_asyncevent_UpdateAsyncEvents();
int bb_input_KeyDown(int);
int bb_input_TouchDown(int);
Float bb_input_TouchX(int);
Float bb_input_TouchY(int);
class c_EffectState : public Object{
	public:
	int m_use_full_bright;
	int m_use_vertex_colors;
	int m_use_flatshade;
	int m_use_fog;
	Array<Float > m_ambient;
	Array<Float > m_diffuse;
	Array<Float > m_specular;
	Array<Float > m_shininess;
	int m_use_depth_test;
	int m_use_depth_write;
	int m_use_backface_culling;
	int m_use_alpha_test;
	int m_use_perpixellighting;
	Float m_red;
	Float m_green;
	Float m_blue;
	Float m_alpha;
	Float m_shine;
	int m_blend;
	int m_fx;
	int m_num_tex;
	Array<c_TTexture* > m_tex;
	c_EffectState();
	c_EffectState* m_new();
	void p_SetNull();
	void p_UpdateEffect(c_TSurface*,c_TEntity*,c_TCamera*);
	void p_Overwrite2(c_EffectState*);
	void mark();
	String debug();
};
String dbg_type(c_EffectState**p){return "EffectState";}
class c_SurfaceAlphaList : public c_List2{
	public:
	c_SurfaceAlphaList();
	c_SurfaceAlphaList* m_new();
	void mark();
	String debug();
};
String dbg_type(c_SurfaceAlphaList**p){return "SurfaceAlphaList";}
class c_FloatBuffer : public Object{
	public:
	c_DataBuffer* m_buf;
	c_FloatBuffer();
	void mark();
	String debug();
};
String dbg_type(c_FloatBuffer**p){return "FloatBuffer";}
class c_TVertexAnim : public c_FloatBuffer{
	public:
	c_TVertexAnim();
	void mark();
	String debug();
};
String dbg_type(c_TVertexAnim**p){return "TVertexAnim";}
class c_TPixmapGL : public c_TPixmap,public virtual c_IPixmapManager{
	public:
	c_DataBuffer* m_pixels;
	int m_format;
	int m_pitch;
	c_TPixmapGL();
	c_TPixmapGL* m_new();
	static int m_Init();
	c_TPixmap* p_CreatePixmap(int,int,int);
	int p_GetPixel(int,int);
	c_TPixmap* p_ResizePixmap(int,int);
	c_TPixmap* p_ResizePixmapNoSmooth(int,int);
	c_TPixmap* p_LoadPixmap(String);
	void p_SetPixel(int,int,int,int,int,int);
	void p_MaskPixmap(int,int,int);
	void p_FreePixmap();
	void mark();
	String debug();
};
String dbg_type(c_TPixmapGL**p){return "TPixmapGL";}
class c_PreloadGL : public Object,public virtual c_IPreloadManager{
	public:
	c_ArrayIntMap* m_p_map;
	c_PreloadGL();
	c_PreloadGL* m_new();
	bool p_IsLoaded(int);
	void p_PreLoadData(String,int);
	void p_SetPixmapFromID(c_TPixmap*,int,String);
	void mark();
	String debug();
};
String dbg_type(c_PreloadGL**p){return "PreloadGL";}
c_TTexture* bb_functions_CreateTexture(int,int,int,int);
Array<Float > bb_mojographics_Transform2D(c_Matrix*,Float,Float,Float);
class c_XMLError : public Object{
	public:
	bool m_error;
	String m_message;
	int m_line;
	int m_column;
	int m_offset;
	c_XMLError();
	c_XMLError* m_new();
	void p_Reset();
	void p_Set4(String,int,int,int);
	String p_ToString();
	void mark();
	String debug();
};
String dbg_type(c_XMLError**p){return "XMLError";}
class c_XMLNode : public Object{
	public:
	String m_value;
	bool m_valid;
	bool m_text;
	String m_name;
	c_XMLDoc* m_doc;
	c_XMLNode* m_parent;
	c_XMLNode* m_lastChild;
	c_XMLNode* m_nextSibling;
	c_XMLNode* m_previousSibling;
	c_XMLNode* m_firstChild;
	c_List13* m_children;
	String m_path;
	c_List13* m_pathList;
	c_Node16* m_pathListNode;
	int m_line;
	int m_column;
	int m_offset;
	c_StringMap3* m_attributes;
	c_XMLNode();
	c_XMLNode* m_new(String,bool);
	c_XMLNode* m_new2();
	c_XMLNode* p_AddText(String);
	void p_SetAttribute(String);
	void p_SetAttribute2(String,bool);
	void p_SetAttribute3(String,int);
	void p_SetAttribute4(String,Float);
	void p_SetAttribute5(String,String);
	c_XMLNode* p_AddChild(String,String,String);
	c_XMLNode* p_GetChild(bool);
	c_XMLNode* p_GetChild2(String,bool);
	c_XMLAttribute* p_GetXMLAttribute(String);
	c_XMLNode* p_GetChild3(String,String,bool);
	c_List13* p_GetChildren(c_List13*,bool);
	c_List13* p_GetChildren2(String,c_List13*,bool);
	c_List13* p_GetChildren3(String,String,c_List13*,bool);
	void mark();
	String debug();
};
String dbg_type(c_XMLNode**p){return "XMLNode";}
class c_XMLDoc : public c_XMLNode{
	public:
	c_XMLNode* m_nullNode;
	String m_version;
	String m_encoding;
	c_StringMap2* m_paths;
	c_XMLDoc();
	c_XMLDoc* m_new(String,String,String);
	c_XMLDoc* m_new2();
	void mark();
	String debug();
};
String dbg_type(c_XMLDoc**p){return "XMLDoc";}
class c_XMLStringBuffer : public Object{
	public:
	int m_chunk;
	int m_count;
	Array<int > m_data;
	int m_dirty;
	String m_cache;
	c_XMLStringBuffer();
	c_XMLStringBuffer* m_new(int);
	int p_Length2();
	int p_Last(int);
	void p_Add4(int);
	void p_Add5(String);
	void p_Add6(String,int,int);
	void p_Clear();
	bool p_Trim();
	String p_value();
	void mark();
	String debug();
};
String dbg_type(c_XMLStringBuffer**p){return "XMLStringBuffer";}
class c_List13 : public Object{
	public:
	c_Node16* m__head;
	c_List13();
	c_List13* m_new();
	c_Node16* p_AddLast13(c_XMLNode*);
	c_List13* m_new2(Array<c_XMLNode* >);
	bool p_IsEmpty();
	c_XMLNode* p_RemoveLast();
	bool p_Equals4(c_XMLNode*,c_XMLNode*);
	c_Node16* p_FindLast(c_XMLNode*,c_Node16*);
	c_Node16* p_FindLast2(c_XMLNode*);
	void p_RemoveLast2(c_XMLNode*);
	c_XMLNode* p_Last2();
	c_Enumerator15* p_ObjectEnumerator();
	void mark();
	String debug();
};
String dbg_type(c_List13**p){return "List";}
class c_Node16 : public Object{
	public:
	c_Node16* m__succ;
	c_Node16* m__pred;
	c_XMLNode* m__data;
	c_Node16();
	c_Node16* m_new(c_Node16*,c_Node16*,c_XMLNode*);
	c_Node16* m_new2();
	int p_Remove();
	void mark();
	String debug();
};
String dbg_type(c_Node16**p){return "Node";}
class c_HeadNode13 : public c_Node16{
	public:
	c_HeadNode13();
	c_HeadNode13* m_new();
	void mark();
	String debug();
};
String dbg_type(c_HeadNode13**p){return "HeadNode";}
bool bb_xml_XMLHasStringAtOffset(String,String,int);
int bb_xml_XMLFindNextAsc(String,int,int);
int bb_xml_XMLFindStringNotInQuotes(String,String,int);
class c_Map6 : public Object{
	public:
	c_Node17* m_root;
	c_Map6();
	c_Map6* m_new();
	virtual int p_Compare3(String,String)=0;
	int p_RotateLeft4(c_Node17*);
	int p_RotateRight4(c_Node17*);
	int p_InsertFixup4(c_Node17*);
	bool p_Set5(String,c_List13*);
	bool p_Insert3(String,c_List13*);
	c_Node17* p_FindNode2(String);
	c_List13* p_Get2(String);
	void mark();
	String debug();
};
String dbg_type(c_Map6**p){return "Map";}
class c_StringMap2 : public c_Map6{
	public:
	c_StringMap2();
	c_StringMap2* m_new();
	int p_Compare3(String,String);
	void mark();
	String debug();
};
String dbg_type(c_StringMap2**p){return "StringMap";}
class c_Node17 : public Object{
	public:
	String m_key;
	c_Node17* m_right;
	c_Node17* m_left;
	c_List13* m_value;
	int m_color;
	c_Node17* m_parent;
	c_Node17();
	c_Node17* m_new(String,c_List13*,int,c_Node17*);
	c_Node17* m_new2();
	void mark();
	String debug();
};
String dbg_type(c_Node17**p){return "Node";}
class c_XMLAttributeQuery : public Object{
	public:
	int m_count;
	Array<c_XMLAttributeQueryItem* > m_items;
	int m_chunk;
	c_XMLAttributeQuery();
	c_XMLAttributeQuery* m_new(String);
	c_XMLAttributeQuery* m_new2();
	int p_Length2();
	bool p_Test(c_XMLNode*);
	void mark();
	String debug();
};
String dbg_type(c_XMLAttributeQuery**p){return "XMLAttributeQuery";}
class c_XMLAttributeQueryItem : public Object{
	public:
	String m_id;
	String m_value;
	bool m_required;
	bool m_special;
	c_XMLAttributeQueryItem();
	c_XMLAttributeQueryItem* m_new(String,String,bool,bool);
	c_XMLAttributeQueryItem* m_new2();
	void mark();
	String debug();
};
String dbg_type(c_XMLAttributeQueryItem**p){return "XMLAttributeQueryItem";}
class c_XMLAttribute : public Object{
	public:
	String m_id;
	String m_value;
	c_XMLAttribute();
	c_XMLAttribute* m_new(String,String);
	c_XMLAttribute* m_new2();
	void mark();
	String debug();
};
String dbg_type(c_XMLAttribute**p){return "XMLAttribute";}
class c_Map7 : public Object{
	public:
	c_Node18* m_root;
	c_Map7();
	c_Map7* m_new();
	virtual int p_Compare3(String,String)=0;
	c_Node18* p_FindNode2(String);
	c_XMLAttribute* p_Get2(String);
	int p_RotateLeft5(c_Node18*);
	int p_RotateRight5(c_Node18*);
	int p_InsertFixup5(c_Node18*);
	bool p_Set6(String,c_XMLAttribute*);
	bool p_Insert4(String,c_XMLAttribute*);
	void mark();
	String debug();
};
String dbg_type(c_Map7**p){return "Map";}
class c_StringMap3 : public c_Map7{
	public:
	c_StringMap3();
	c_StringMap3* m_new();
	int p_Compare3(String,String);
	void mark();
	String debug();
};
String dbg_type(c_StringMap3**p){return "StringMap";}
class c_Node18 : public Object{
	public:
	String m_key;
	c_Node18* m_right;
	c_Node18* m_left;
	c_XMLAttribute* m_value;
	int m_color;
	c_Node18* m_parent;
	c_Node18();
	c_Node18* m_new(String,c_XMLAttribute*,int,c_Node18*);
	c_Node18* m_new2();
	void mark();
	String debug();
};
String dbg_type(c_Node18**p){return "Node";}
c_XMLDoc* bb_xml_ParseXML(String,c_XMLError*,int);
class c_Enumerator15 : public Object{
	public:
	c_List13* m__list;
	c_Node16* m__curr;
	c_Enumerator15();
	c_Enumerator15* m_new(c_List13*);
	c_Enumerator15* m_new2();
	bool p_HasNext();
	c_XMLNode* p_NextObject();
	void mark();
	String debug();
};
String dbg_type(c_Enumerator15**p){return "Enumerator";}
int bb_tutility_Dprint(String,String,String,String,String,String);
class c_PreloadData : public Object{
	public:
	bool m_loaded;
	int m_id;
	c_DataBuffer* m_data;
	int m_w;
	int m_h;
	c_PreloadData();
	c_PreloadData* m_new();
	void mark();
	String debug();
};
String dbg_type(c_PreloadData**p){return "PreloadData";}
class c_ArrayIntMap : public Object{
	public:
	Array<c_PreloadData* > m_data;
	int m_length;
	c_ArrayIntMap();
	c_ArrayIntMap* m_new();
	c_PreloadData* p_Get(int);
	void p_Set7(int,c_PreloadData*);
	void mark();
	String debug();
};
String dbg_type(c_ArrayIntMap**p){return "ArrayIntMap";}
c_DataBuffer* bb_gles11_LoadImageData(String,Array<int >);
class c_AsyncSocketIoOp : public c_AsyncOp{
	public:
	BBSocket* m__socket;
	c_DataBuffer* m__data;
	int m__offset;
	int m__count;
	c_AsyncSocketIoOp();
	c_AsyncSocketIoOp* m_new(BBSocket*,c_DataBuffer*,int,int);
	c_AsyncSocketIoOp* m_new2();
	void mark();
	String debug();
};
String dbg_type(c_AsyncSocketIoOp**p){return "AsyncSocketIoOp";}
class c_AsyncSendOp : public c_AsyncSocketIoOp{
	public:
	c_IOnSendComplete* m__onComplete;
	c_AsyncSendOp();
	c_AsyncSendOp* m_new(BBSocket*,c_DataBuffer*,int,int,c_IOnSendComplete*);
	c_AsyncSendOp* m_new2();
	void p_Execute__UNSAFE__(c_Socket*);
	void p_Complete(c_Socket*);
	void mark();
	String debug();
};
String dbg_type(c_AsyncSendOp**p){return "AsyncSendOp";}
class c_AsyncReceiveOp : public c_AsyncSocketIoOp{
	public:
	c_IOnReceiveComplete* m__onComplete;
	c_AsyncReceiveOp();
	c_AsyncReceiveOp* m_new(BBSocket*,c_DataBuffer*,int,int,c_IOnReceiveComplete*);
	c_AsyncReceiveOp* m_new2();
	void p_Execute__UNSAFE__(c_Socket*);
	void p_Complete(c_Socket*);
	void mark();
	String debug();
};
String dbg_type(c_AsyncReceiveOp**p){return "AsyncReceiveOp";}
c_App::c_App(){
}
c_App* c_App::m_new(){
	DBG_ENTER("App.new")
	c_App *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<152>");
	if((bb_app2__app)!=0){
		DBG_BLOCK();
		bbError(String(L"App has already been created",28));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<153>");
	gc_assign(bb_app2__app,this);
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<154>");
	gc_assign(bb_app2__delegate,(new c_GameDelegate)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<155>");
	bb_app2__game->SetDelegate(bb_app2__delegate);
	return this;
}
int c_App::p_OnResize(){
	DBG_ENTER("App.OnResize")
	c_App *self=this;
	DBG_LOCAL(self,"Self")
	return 0;
}
int c_App::p_OnCreate(){
	DBG_ENTER("App.OnCreate")
	c_App *self=this;
	DBG_LOCAL(self,"Self")
	return 0;
}
int c_App::p_OnSuspend(){
	DBG_ENTER("App.OnSuspend")
	c_App *self=this;
	DBG_LOCAL(self,"Self")
	return 0;
}
int c_App::p_OnResume(){
	DBG_ENTER("App.OnResume")
	c_App *self=this;
	DBG_LOCAL(self,"Self")
	return 0;
}
int c_App::p_OnUpdate(){
	DBG_ENTER("App.OnUpdate")
	c_App *self=this;
	DBG_LOCAL(self,"Self")
	return 0;
}
int c_App::p_OnLoading(){
	DBG_ENTER("App.OnLoading")
	c_App *self=this;
	DBG_LOCAL(self,"Self")
	return 0;
}
int c_App::p_OnRender(){
	DBG_ENTER("App.OnRender")
	c_App *self=this;
	DBG_LOCAL(self,"Self")
	return 0;
}
int c_App::p_OnClose(){
	DBG_ENTER("App.OnClose")
	c_App *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<177>");
	bb_app2_EndApp();
	return 0;
}
int c_App::p_OnBack(){
	DBG_ENTER("App.OnBack")
	c_App *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<181>");
	p_OnClose();
	return 0;
}
void c_App::mark(){
	Object::mark();
}
String c_App::debug(){
	String t="(App)\n";
	return t;
}
c_MiniB3DApp::c_MiniB3DApp(){
	m_preload_list=(new c_StringList)->m_new2();
	m_init=0;
	m_old_ms=0;
	m_renders=0;
	m_fps=0;
}
c_MiniB3DApp* c_MiniB3DApp::m_new(){
	DBG_ENTER("MiniB3DApp.new")
	c_MiniB3DApp *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/app.monkey<12>");
	c_App::m_new();
	return this;
}
int c_MiniB3DApp::p_PreLoad(String t_f){
	DBG_ENTER("MiniB3DApp.PreLoad")
	c_MiniB3DApp *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_f,"f")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/app.monkey<28>");
	m_preload_list->p_AddLast4(t_f);
	return 0;
}
int c_MiniB3DApp::p_PreLoad2(Array<String > t_f){
	DBG_ENTER("MiniB3DApp.PreLoad")
	c_MiniB3DApp *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_f,"f")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/app.monkey<32>");
	Array<String > t_=t_f;
	int t_2=0;
	while(t_2<t_.Length()){
		DBG_BLOCK();
		String t_s=t_.At(t_2);
		t_2=t_2+1;
		DBG_LOCAL(t_s,"s")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/app.monkey<33>");
		m_preload_list->p_AddLast4(t_s);
	}
	return 0;
}
int c_MiniB3DApp::p_Create(){
	DBG_ENTER("MiniB3DApp.Create")
	c_MiniB3DApp *self=this;
	DBG_LOCAL(self,"Self")
	return 0;
}
int c_MiniB3DApp::p_Init(){
	DBG_ENTER("MiniB3DApp.Init")
	c_MiniB3DApp *self=this;
	DBG_LOCAL(self,"Self")
	return 0;
}
void c_MiniB3DApp::p_Minib3dInit(){
	DBG_ENTER("MiniB3DApp.Minib3dInit")
	c_MiniB3DApp *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/app.monkey<49>");
	if((m_init)!=0){
		DBG_BLOCK();
		return;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/app.monkey<51>");
	if(!((c_TPixmap::m_PreLoadPixmap(m_preload_list->p_ToArray()))!=0)){
		DBG_BLOCK();
		return;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/app.monkey<52>");
	m_init=1;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/app.monkey<53>");
	p_Init();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/app.monkey<54>");
	m_init=2;
}
int c_MiniB3DApp::p_OnCreate(){
	DBG_ENTER("MiniB3DApp.OnCreate")
	c_MiniB3DApp *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/app.monkey<38>");
	bb_app2_SetUpdateRate(30);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/app.monkey<39>");
	bb_opengles11_SetRender(0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/app.monkey<40>");
	p_PreLoad(String(L"mojo_font.png",13));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/app.monkey<41>");
	p_Create();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/app.monkey<42>");
	p_Minib3dInit();
	return 0;
}
int c_MiniB3DApp::p_Update(){
	DBG_ENTER("MiniB3DApp.Update")
	c_MiniB3DApp *self=this;
	DBG_LOCAL(self,"Self")
	return 0;
}
int c_MiniB3DApp::p_OnUpdate(){
	DBG_ENTER("MiniB3DApp.OnUpdate")
	c_MiniB3DApp *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/app.monkey<62>");
	if(!((m_init)!=0)){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/app.monkey<63>");
		p_Minib3dInit();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/app.monkey<64>");
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/app.monkey<67>");
	p_Update();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/app.monkey<70>");
	if(bb_app2_Millisecs()-m_old_ms>=1000){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/app.monkey<71>");
		m_old_ms=bb_app2_Millisecs();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/app.monkey<72>");
		m_fps=m_renders;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/app.monkey<73>");
		m_renders=0;
	}
	return 0;
}
int c_MiniB3DApp::p_PreLoadRender(){
	DBG_ENTER("MiniB3DApp.PreLoadRender")
	c_MiniB3DApp *self=this;
	DBG_LOCAL(self,"Self")
	return 0;
}
bool c_MiniB3DApp::m__resumed;
int c_MiniB3DApp::p_Render(){
	DBG_ENTER("MiniB3DApp.Render")
	c_MiniB3DApp *self=this;
	DBG_LOCAL(self,"Self")
	return 0;
}
int c_MiniB3DApp::p_OnRender(){
	DBG_ENTER("MiniB3DApp.OnRender")
	c_MiniB3DApp *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/app.monkey<83>");
	if(!((m_init)!=0)){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/app.monkey<84>");
		p_PreLoadRender();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/app.monkey<85>");
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/app.monkey<88>");
	if(m__resumed){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/app.monkey<98>");
		m__resumed=false;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/app.monkey<101>");
	p_Render();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/app.monkey<103>");
	bb_functions_RenderWorld();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/app.monkey<104>");
	m_renders=m_renders+1;
	return 0;
}
bool c_MiniB3DApp::m__suspend;
int c_MiniB3DApp::p_Resume(){
	DBG_ENTER("MiniB3DApp.Resume")
	c_MiniB3DApp *self=this;
	DBG_LOCAL(self,"Self")
	return 0;
}
int c_MiniB3DApp::p_OnResume(){
	DBG_ENTER("MiniB3DApp.OnResume")
	c_MiniB3DApp *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/app.monkey<124>");
	m__resumed=true;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/app.monkey<125>");
	if(m__suspend){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/app.monkey<126>");
		m__suspend=false;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/app.monkey<129>");
	p_Resume();
	return 0;
}
void c_MiniB3DApp::mark(){
	c_App::mark();
	gc_mark_q(m_preload_list);
}
String c_MiniB3DApp::debug(){
	String t="(MiniB3DApp)\n";
	t=c_App::debug()+t;
	t+=dbg_decl("_resumed",&c_MiniB3DApp::m__resumed);
	t+=dbg_decl("_suspend",&c_MiniB3DApp::m__suspend);
	t+=dbg_decl("init",&m_init);
	t+=dbg_decl("old_ms",&m_old_ms);
	t+=dbg_decl("renders",&m_renders);
	t+=dbg_decl("fps",&m_fps);
	t+=dbg_decl("preload_list",&m_preload_list);
	return t;
}
c_Game::c_Game(){
	m_hndlr=0;
	m_CB3D=0;
	m_dt=0;
	m_cam=0;
	m_light=0;
	m_mesh=0;
	m_txt=0;
	m_init_gl=false;
	m_TestTexture=0;
	m_Cimg=0;
	m_touchBegin=0;
	m_oldTouchX=0;
	m_oldTouchY=0;
	m_lr=FLOAT(.0);
	m_ud=FLOAT(.0);
}
c_Game* c_Game::m_new(){
	DBG_ENTER("Game.new")
	c_Game *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<15>");
	c_MiniB3DApp::m_new();
	return this;
}
int c_Game::p_OnCreate(){
	DBG_ENTER("Game.OnCreate")
	c_Game *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<33>");
	bb_opengles11_SetRender(0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<34>");
	bb_app2_SetUpdateRate(30);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<35>");
	p_PreLoad(String(L"mojo_font.png",13));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<36>");
	gc_assign(m_hndlr,(new c_CalLoaderHandler)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<37>");
	m_hndlr->p_LoadFile(String(L"http://vigilsoft.net/democal3d/test.xsf",39),0,((new c_SKNCalSkeletonLoader)->m_new()),String());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<38>");
	m_hndlr->p_LoadFile(String(L"http://vigilsoft.net/democal3d/testpp.xmf",41),0,((new c_SKNCalMeshLoader)->m_new()),String());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<39>");
	m_hndlr->p_LoadFile(String(L"http://vigilsoft.net/democal3d/run.xaf",38),0,((new c_SKNCalAnimationLoader)->m_new()),String());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<40>");
	m_hndlr->p_LoadFile(String(L"http://vigilsoft.net/democal3d/getxmlimage.php?a=paladin_chest.jpg",66),0,((new c_SKNCalImageLoader)->m_new()),String());
	return 0;
}
int c_Game::p_Init(){
	DBG_ENTER("Game.Init")
	c_Game *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<48>");
	gc_assign(m_CB3D,(new c_Cal3dB3d)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<49>");
	gc_assign(m_dt,(new c_DeltaTimer)->m_new(FLOAT(30.0)));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<52>");
	gc_assign(m_cam,bb_functions_CreateCamera(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<53>");
	m_cam->p_CameraClsColor(FLOAT(0.0),FLOAT(0.0),FLOAT(80.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<54>");
	m_cam->p_PositionEntity(FLOAT(0.0),FLOAT(4.0),FLOAT(-50.0),0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<55>");
	m_cam->p_RotateEntity(FLOAT(-90.0),FLOAT(0.0),FLOAT(0.0),0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<56>");
	gc_assign(m_light,bb_functions_CreateLight(1,0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<57>");
	m_light->p_PositionEntity(FLOAT(0.0),FLOAT(3.0),FLOAT(-3.0),0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<59>");
	gc_assign(m_mesh,bb_functions_CreateCube(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<60>");
	gc_assign(m_txt,c_TText::m_CreateText2D(0,String(),String(),96,9,0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<61>");
	bbPrint(String(L"main: init done",15));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<62>");
	m_init_gl=true;
	return 0;
}
int c_Game::p_Update(){
	DBG_ENTER("Game.Update")
	c_Game *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<70>");
	if(((bb_input_KeyHit(432))!=0) || ((bb_input_KeyHit(27))!=0)){
		DBG_BLOCK();
		bbError(String());
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<78>");
	if(m_CB3D!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<79>");
		if(m_CB3D->m_isloaded==false){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<80>");
			if(m_hndlr->p_IsFileLoaded(String(L"http://vigilsoft.net/democal3d/test.xsf",39))==true && m_hndlr->p_IsFileLoaded(String(L"http://vigilsoft.net/democal3d/testpp.xmf",41))==true && m_hndlr->p_IsFileLoaded(String(L"http://vigilsoft.net/democal3d/run.xaf",38))==true){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<81>");
				m_CB3D->p_SetSkeleton(dynamic_cast<c_CalCoreSkeleton*>(m_hndlr->p_GetLoadedFile(String(L"http://vigilsoft.net/democal3d/test.xsf",39),true)));
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<82>");
				m_CB3D->p_AddMesh(dynamic_cast<c_CalCoreMesh*>(m_hndlr->p_GetLoadedFile(String(L"http://vigilsoft.net/democal3d/testpp.xmf",41),true)));
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<83>");
				m_CB3D->p_AddAnim(dynamic_cast<c_CalCoreAnimation*>(m_hndlr->p_GetLoadedFile(String(L"http://vigilsoft.net/democal3d/run.xaf",38),true)));
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<84>");
				bbPrint(String(L"Building Mesh",13));
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<85>");
				m_CB3D->p_Build();
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<86>");
				m_CB3D->m_CModel->p_getMixer()->p_blendCycle(0,FLOAT(1.0),FLOAT(0.0));
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<87>");
				m_CB3D->m_isloaded=true;
			}
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<90>");
			m_CB3D->p_Update3(m_dt->m_delta/FLOAT(30.0));
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<93>");
	if(m_TestTexture==0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<94>");
		if(m_hndlr->p_IsFileLoaded(String(L"http://vigilsoft.net/democal3d/getxmlimage.php?a=paladin_chest.jpg",66))==true){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<95>");
			gc_assign(m_Cimg,dynamic_cast<c_CalImage*>(m_hndlr->p_GetLoadedFile(String(L"http://vigilsoft.net/democal3d/getxmlimage.php?a=paladin_chest.jpg",66),true)));
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<99>");
	if(m_Cimg!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<100>");
		if(m_Cimg->p_IsFinished()==false){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<102>");
			m_Cimg->p_Update();
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<105>");
			bb_functions_EntityTexture((m_CB3D->m_B3dModel),m_Cimg->m_texture,0,0);
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<106>");
			c_Enumerator14* t_=m_CB3D->m_Meshes->p_ObjectEnumerator();
			while(t_->p_HasNext()){
				DBG_BLOCK();
				c_Cal3dB3dMesh* t_msh=t_->p_NextObject();
				DBG_LOCAL(t_msh,"msh")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<107>");
				bb_functions_EntityTexture((t_msh->m_B3dMesh),m_Cimg->m_texture,0,0);
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<109>");
			bb_functions_EntityTexture((m_mesh),m_Cimg->m_texture,0,0);
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<112>");
	bb_asyncevent_UpdateAsyncEvents();
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<113>");
	m_hndlr->p_Update();
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<114>");
	m_dt->p_UpdateDelta();
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<116>");
	Float t_cr=Float(bb_input_KeyDown(37)-bb_input_KeyDown(39));
	DBG_LOCAL(t_cr,"cr")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<117>");
	Float t_cu=Float(bb_input_KeyDown(40)-bb_input_KeyDown(38));
	DBG_LOCAL(t_cu,"cu")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<119>");
	Float t_camin=Float(bb_input_KeyDown(87)-bb_input_KeyDown(83));
	DBG_LOCAL(t_camin,"camin")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<120>");
	Float t_camup=Float(bb_input_KeyDown(68)-bb_input_KeyDown(65));
	DBG_LOCAL(t_camup,"camup")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<122>");
	Float t_turnzx=Float(bb_input_KeyDown(90)-bb_input_KeyDown(88));
	DBG_LOCAL(t_turnzx,"turnzx")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<124>");
	if(((bb_input_TouchDown(0))!=0) && !((bb_input_TouchDown(1))!=0)){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<125>");
		if(!((m_touchBegin)!=0)){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<126>");
			m_oldTouchX=int(bb_input_TouchX(0));
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<127>");
			m_oldTouchY=int(bb_input_TouchY(0));
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<128>");
			m_touchBegin=1;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<130>");
		m_lr=(bb_input_TouchX(0)-Float(m_oldTouchX))*FLOAT(0.5);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<131>");
		m_ud=(-bb_input_TouchY(0)+Float(m_oldTouchY))*FLOAT(0.5);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<132>");
		m_oldTouchX=int(bb_input_TouchX(0));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<133>");
		m_oldTouchY=int(bb_input_TouchY(0));
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<134>");
		if((bb_input_TouchDown(1))!=0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<135>");
			if(!((m_touchBegin)!=0)){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<136>");
				m_oldTouchX=int(bb_input_TouchX(0));
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<137>");
				m_oldTouchY=int(bb_input_TouchY(0));
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<138>");
				m_touchBegin=1;
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<140>");
			t_camup=(-bb_input_TouchX(0)+Float(m_oldTouchX))*FLOAT(0.1);
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<141>");
			t_camin=(-bb_input_TouchY(0)+Float(m_oldTouchY))*FLOAT(0.1);
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<142>");
			m_oldTouchX=int(bb_input_TouchX(0));
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<143>");
			m_oldTouchY=int(bb_input_TouchY(0));
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<145>");
			m_touchBegin=0;
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<148>");
	m_cam->p_MoveEntity(t_camup,FLOAT(0.0),t_camin);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<149>");
	m_cam->p_TurnEntity(t_cu,t_cr,FLOAT(0.0),0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<151>");
	m_txt->p_SetText(String(L"Cam: ",5)+String(t_camup)+String(L" ",1)+String(t_camin)+String(L" ",1)+String(t_cu)+String(L" ",1)+String(t_cr)+String(L" delta: ",8)+String(m_dt->m_delta),FLOAT(0.0),FLOAT(0.0),FLOAT(0.0),0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<152>");
	m_txt->p_HideEntity();
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<153>");
	m_txt->p_Draw(FLOAT(0.0),FLOAT(0.0),false);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<156>");
	return 0;
}
int c_Game::p_Render(){
	DBG_ENTER("Game.Render")
	c_Game *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<161>");
	bb_mojographics_SetMojoEmulation();
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<164>");
	return 0;
}
void c_Game::mark(){
	c_MiniB3DApp::mark();
	gc_mark_q(m_hndlr);
	gc_mark_q(m_CB3D);
	gc_mark_q(m_dt);
	gc_mark_q(m_cam);
	gc_mark_q(m_light);
	gc_mark_q(m_mesh);
	gc_mark_q(m_txt);
	gc_mark_q(m_TestTexture);
	gc_mark_q(m_Cimg);
}
String c_Game::debug(){
	String t="(Game)\n";
	t=c_MiniB3DApp::debug()+t;
	t+=dbg_decl("cam",&m_cam);
	t+=dbg_decl("light",&m_light);
	t+=dbg_decl("init_gl",&m_init_gl);
	t+=dbg_decl("oldTouchX",&m_oldTouchX);
	t+=dbg_decl("oldTouchY",&m_oldTouchY);
	t+=dbg_decl("touchBegin",&m_touchBegin);
	t+=dbg_decl("lr",&m_lr);
	t+=dbg_decl("ud",&m_ud);
	t+=dbg_decl("txt",&m_txt);
	t+=dbg_decl("dt",&m_dt);
	t+=dbg_decl("hndlr",&m_hndlr);
	t+=dbg_decl("CB3D",&m_CB3D);
	t+=dbg_decl("Cimg",&m_Cimg);
	t+=dbg_decl("TestTexture",&m_TestTexture);
	t+=dbg_decl("mesh",&m_mesh);
	return t;
}
c_App* bb_app2__app;
c_GameDelegate::c_GameDelegate(){
	m__graphics=0;
	m__audio=0;
	m__input=0;
}
c_GameDelegate* c_GameDelegate::m_new(){
	DBG_ENTER("GameDelegate.new")
	c_GameDelegate *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<65>");
	return this;
}
void c_GameDelegate::StartGame(){
	DBG_ENTER("GameDelegate.StartGame")
	c_GameDelegate *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<75>");
	gc_assign(m__graphics,(new gxtkGraphics));
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<76>");
	bb_graphics_SetGraphicsDevice(m__graphics);
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<77>");
	bb_graphics_SetFont(0,32);
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<79>");
	gc_assign(m__audio,(new gxtkAudio));
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<80>");
	bb_audio_SetAudioDevice(m__audio);
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<82>");
	gc_assign(m__input,(new c_InputDevice)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<83>");
	bb_input_SetInputDevice(m__input);
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<85>");
	bb_app2_ValidateDeviceWindow(false);
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<87>");
	bb_app2_EnumDisplayModes();
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<89>");
	bb_app2__app->p_OnCreate();
}
void c_GameDelegate::SuspendGame(){
	DBG_ENTER("GameDelegate.SuspendGame")
	c_GameDelegate *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<93>");
	bb_app2__app->p_OnSuspend();
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<94>");
	m__audio->Suspend();
}
void c_GameDelegate::ResumeGame(){
	DBG_ENTER("GameDelegate.ResumeGame")
	c_GameDelegate *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<98>");
	m__audio->Resume();
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<99>");
	bb_app2__app->p_OnResume();
}
void c_GameDelegate::UpdateGame(){
	DBG_ENTER("GameDelegate.UpdateGame")
	c_GameDelegate *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<103>");
	bb_app2_ValidateDeviceWindow(true);
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<104>");
	m__input->p_BeginUpdate();
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<105>");
	bb_app2__app->p_OnUpdate();
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<106>");
	m__input->p_EndUpdate();
}
void c_GameDelegate::RenderGame(){
	DBG_ENTER("GameDelegate.RenderGame")
	c_GameDelegate *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<110>");
	bb_app2_ValidateDeviceWindow(true);
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<111>");
	int t_mode=m__graphics->BeginRender();
	DBG_LOCAL(t_mode,"mode")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<112>");
	if((t_mode)!=0){
		DBG_BLOCK();
		bb_graphics_BeginRender();
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<113>");
	if(t_mode==2){
		DBG_BLOCK();
		bb_app2__app->p_OnLoading();
	}else{
		DBG_BLOCK();
		bb_app2__app->p_OnRender();
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<114>");
	if((t_mode)!=0){
		DBG_BLOCK();
		bb_graphics_EndRender();
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<115>");
	m__graphics->EndRender();
}
void c_GameDelegate::KeyEvent(int t_event,int t_data){
	DBG_ENTER("GameDelegate.KeyEvent")
	c_GameDelegate *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_event,"event")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<119>");
	m__input->p_KeyEvent(t_event,t_data);
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<120>");
	if(t_event!=1){
		DBG_BLOCK();
		return;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<121>");
	int t_1=t_data;
	DBG_LOCAL(t_1,"1")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<122>");
	if(t_1==432){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<123>");
		bb_app2__app->p_OnClose();
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<124>");
		if(t_1==416){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<125>");
			bb_app2__app->p_OnBack();
		}
	}
}
void c_GameDelegate::MouseEvent(int t_event,int t_data,Float t_x,Float t_y){
	DBG_ENTER("GameDelegate.MouseEvent")
	c_GameDelegate *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_event,"event")
	DBG_LOCAL(t_data,"data")
	DBG_LOCAL(t_x,"x")
	DBG_LOCAL(t_y,"y")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<130>");
	m__input->p_MouseEvent(t_event,t_data,t_x,t_y);
}
void c_GameDelegate::TouchEvent(int t_event,int t_data,Float t_x,Float t_y){
	DBG_ENTER("GameDelegate.TouchEvent")
	c_GameDelegate *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_event,"event")
	DBG_LOCAL(t_data,"data")
	DBG_LOCAL(t_x,"x")
	DBG_LOCAL(t_y,"y")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<134>");
	m__input->p_TouchEvent(t_event,t_data,t_x,t_y);
}
void c_GameDelegate::MotionEvent(int t_event,int t_data,Float t_x,Float t_y,Float t_z){
	DBG_ENTER("GameDelegate.MotionEvent")
	c_GameDelegate *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_event,"event")
	DBG_LOCAL(t_data,"data")
	DBG_LOCAL(t_x,"x")
	DBG_LOCAL(t_y,"y")
	DBG_LOCAL(t_z,"z")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<138>");
	m__input->p_MotionEvent(t_event,t_data,t_x,t_y,t_z);
}
void c_GameDelegate::DiscardGraphics(){
	DBG_ENTER("GameDelegate.DiscardGraphics")
	c_GameDelegate *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<142>");
	m__graphics->DiscardGraphics();
}
void c_GameDelegate::mark(){
	BBGameDelegate::mark();
	gc_mark_q(m__graphics);
	gc_mark_q(m__audio);
	gc_mark_q(m__input);
}
String c_GameDelegate::debug(){
	String t="(GameDelegate)\n";
	t+=dbg_decl("_graphics",&m__graphics);
	t+=dbg_decl("_audio",&m__audio);
	t+=dbg_decl("_input",&m__input);
	return t;
}
c_GameDelegate* bb_app2__delegate;
BBGame* bb_app2__game;
int bbMain(){
	DBG_ENTER("Main")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/examples/cal3dsknloader.monkey<10>");
	(new c_Game)->m_new();
	return 0;
}
gxtkGraphics* bb_graphics_device;
int bb_graphics_SetGraphicsDevice(gxtkGraphics* t_dev){
	DBG_ENTER("SetGraphicsDevice")
	DBG_LOCAL(t_dev,"dev")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<63>");
	gc_assign(bb_graphics_device,t_dev);
	return 0;
}
c_Image::c_Image(){
	m_surface=0;
	m_width=0;
	m_height=0;
	m_frames=Array<c_Frame* >();
	m_flags=0;
	m_tx=FLOAT(.0);
	m_ty=FLOAT(.0);
	m_source=0;
}
int c_Image::m_DefaultFlags;
c_Image* c_Image::m_new(){
	DBG_ENTER("Image.new")
	c_Image *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<70>");
	return this;
}
int c_Image::p_SetHandle(Float t_tx,Float t_ty){
	DBG_ENTER("Image.SetHandle")
	c_Image *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_tx,"tx")
	DBG_LOCAL(t_ty,"ty")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<114>");
	this->m_tx=t_tx;
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<115>");
	this->m_ty=t_ty;
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<116>");
	this->m_flags=this->m_flags&-2;
	return 0;
}
int c_Image::p_ApplyFlags(int t_iflags){
	DBG_ENTER("Image.ApplyFlags")
	c_Image *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_iflags,"iflags")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<192>");
	m_flags=t_iflags;
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<194>");
	if((m_flags&2)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<195>");
		Array<c_Frame* > t_=m_frames;
		int t_2=0;
		while(t_2<t_.Length()){
			DBG_BLOCK();
			c_Frame* t_f=t_.At(t_2);
			t_2=t_2+1;
			DBG_LOCAL(t_f,"f")
			DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<196>");
			t_f->m_x+=1;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<198>");
		m_width-=2;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<201>");
	if((m_flags&4)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<202>");
		Array<c_Frame* > t_3=m_frames;
		int t_4=0;
		while(t_4<t_3.Length()){
			DBG_BLOCK();
			c_Frame* t_f2=t_3.At(t_4);
			t_4=t_4+1;
			DBG_LOCAL(t_f2,"f")
			DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<203>");
			t_f2->m_y+=1;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<205>");
		m_height-=2;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<208>");
	if((m_flags&1)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<209>");
		p_SetHandle(Float(m_width)/FLOAT(2.0),Float(m_height)/FLOAT(2.0));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<212>");
	if(m_frames.Length()==1 && m_frames.At(0)->m_x==0 && m_frames.At(0)->m_y==0 && m_width==m_surface->Width() && m_height==m_surface->Height()){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<213>");
		m_flags|=65536;
	}
	return 0;
}
c_Image* c_Image::p_Init2(gxtkSurface* t_surf,int t_nframes,int t_iflags){
	DBG_ENTER("Image.Init")
	c_Image *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_surf,"surf")
	DBG_LOCAL(t_nframes,"nframes")
	DBG_LOCAL(t_iflags,"iflags")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<150>");
	gc_assign(m_surface,t_surf);
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<152>");
	m_width=m_surface->Width()/t_nframes;
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<153>");
	m_height=m_surface->Height();
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<155>");
	gc_assign(m_frames,Array<c_Frame* >(t_nframes));
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<156>");
	for(int t_i=0;t_i<t_nframes;t_i=t_i+1){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<157>");
		gc_assign(m_frames.At(t_i),(new c_Frame)->m_new(t_i*m_width,0));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<160>");
	p_ApplyFlags(t_iflags);
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<161>");
	return this;
}
c_Image* c_Image::p_Init3(gxtkSurface* t_surf,int t_x,int t_y,int t_iwidth,int t_iheight,int t_nframes,int t_iflags,c_Image* t_src,int t_srcx,int t_srcy,int t_srcw,int t_srch){
	DBG_ENTER("Image.Init")
	c_Image *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_surf,"surf")
	DBG_LOCAL(t_x,"x")
	DBG_LOCAL(t_y,"y")
	DBG_LOCAL(t_iwidth,"iwidth")
	DBG_LOCAL(t_iheight,"iheight")
	DBG_LOCAL(t_nframes,"nframes")
	DBG_LOCAL(t_iflags,"iflags")
	DBG_LOCAL(t_src,"src")
	DBG_LOCAL(t_srcx,"srcx")
	DBG_LOCAL(t_srcy,"srcy")
	DBG_LOCAL(t_srcw,"srcw")
	DBG_LOCAL(t_srch,"srch")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<165>");
	gc_assign(m_surface,t_surf);
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<166>");
	gc_assign(m_source,t_src);
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<168>");
	m_width=t_iwidth;
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<169>");
	m_height=t_iheight;
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<171>");
	gc_assign(m_frames,Array<c_Frame* >(t_nframes));
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<173>");
	int t_ix=t_x;
	int t_iy=t_y;
	DBG_LOCAL(t_ix,"ix")
	DBG_LOCAL(t_iy,"iy")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<175>");
	for(int t_i=0;t_i<t_nframes;t_i=t_i+1){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<176>");
		if(t_ix+m_width>t_srcw){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<177>");
			t_ix=0;
			DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<178>");
			t_iy+=m_height;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<180>");
		if(t_ix+m_width>t_srcw || t_iy+m_height>t_srch){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<181>");
			bbError(String(L"Image frame outside surface",27));
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<183>");
		gc_assign(m_frames.At(t_i),(new c_Frame)->m_new(t_ix+t_srcx,t_iy+t_srcy));
		DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<184>");
		t_ix+=m_width;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<187>");
	p_ApplyFlags(t_iflags);
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<188>");
	return this;
}
int c_Image::p_Width(){
	DBG_ENTER("Image.Width")
	c_Image *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<81>");
	return m_width;
}
void c_Image::mark(){
	Object::mark();
	gc_mark_q(m_surface);
	gc_mark_q(m_frames);
	gc_mark_q(m_source);
}
String c_Image::debug(){
	String t="(Image)\n";
	t+=dbg_decl("DefaultFlags",&c_Image::m_DefaultFlags);
	t+=dbg_decl("source",&m_source);
	t+=dbg_decl("surface",&m_surface);
	t+=dbg_decl("width",&m_width);
	t+=dbg_decl("height",&m_height);
	t+=dbg_decl("flags",&m_flags);
	t+=dbg_decl("frames",&m_frames);
	t+=dbg_decl("tx",&m_tx);
	t+=dbg_decl("ty",&m_ty);
	return t;
}
c_GraphicsContext::c_GraphicsContext(){
	m_defaultFont=0;
	m_font=0;
	m_firstChar=0;
	m_matrixSp=0;
	m_ix=FLOAT(1.0);
	m_iy=FLOAT(.0);
	m_jx=FLOAT(.0);
	m_jy=FLOAT(1.0);
	m_tx=FLOAT(.0);
	m_ty=FLOAT(.0);
	m_tformed=0;
	m_matDirty=0;
	m_color_r=FLOAT(.0);
	m_color_g=FLOAT(.0);
	m_color_b=FLOAT(.0);
	m_alpha=FLOAT(.0);
	m_blend=0;
	m_scissor_x=FLOAT(.0);
	m_scissor_y=FLOAT(.0);
	m_scissor_width=FLOAT(.0);
	m_scissor_height=FLOAT(.0);
}
c_GraphicsContext* c_GraphicsContext::m_new(){
	DBG_ENTER("GraphicsContext.new")
	c_GraphicsContext *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<29>");
	return this;
}
void c_GraphicsContext::mark(){
	Object::mark();
	gc_mark_q(m_defaultFont);
	gc_mark_q(m_font);
}
String c_GraphicsContext::debug(){
	String t="(GraphicsContext)\n";
	t+=dbg_decl("color_r",&m_color_r);
	t+=dbg_decl("color_g",&m_color_g);
	t+=dbg_decl("color_b",&m_color_b);
	t+=dbg_decl("alpha",&m_alpha);
	t+=dbg_decl("blend",&m_blend);
	t+=dbg_decl("ix",&m_ix);
	t+=dbg_decl("iy",&m_iy);
	t+=dbg_decl("jx",&m_jx);
	t+=dbg_decl("jy",&m_jy);
	t+=dbg_decl("tx",&m_tx);
	t+=dbg_decl("ty",&m_ty);
	t+=dbg_decl("tformed",&m_tformed);
	t+=dbg_decl("matDirty",&m_matDirty);
	t+=dbg_decl("scissor_x",&m_scissor_x);
	t+=dbg_decl("scissor_y",&m_scissor_y);
	t+=dbg_decl("scissor_width",&m_scissor_width);
	t+=dbg_decl("scissor_height",&m_scissor_height);
	t+=dbg_decl("matrixSp",&m_matrixSp);
	t+=dbg_decl("font",&m_font);
	t+=dbg_decl("firstChar",&m_firstChar);
	t+=dbg_decl("defaultFont",&m_defaultFont);
	return t;
}
c_GraphicsContext* bb_graphics_context;
String bb_data_FixDataPath(String t_path){
	DBG_ENTER("FixDataPath")
	DBG_LOCAL(t_path,"path")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/data.monkey<7>");
	int t_i=t_path.Find(String(L":/",2),0);
	DBG_LOCAL(t_i,"i")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/data.monkey<8>");
	if(t_i!=-1 && t_path.Find(String(L"/",1),0)==t_i+1){
		DBG_BLOCK();
		return t_path;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/data.monkey<9>");
	if(t_path.StartsWith(String(L"./",2)) || t_path.StartsWith(String(L"/",1))){
		DBG_BLOCK();
		return t_path;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/data.monkey<10>");
	String t_=String(L"monkey://data/",14)+t_path;
	return t_;
}
c_Frame::c_Frame(){
	m_x=0;
	m_y=0;
}
c_Frame* c_Frame::m_new(int t_x,int t_y){
	DBG_ENTER("Frame.new")
	c_Frame *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_x,"x")
	DBG_LOCAL(t_y,"y")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<23>");
	this->m_x=t_x;
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<24>");
	this->m_y=t_y;
	return this;
}
c_Frame* c_Frame::m_new2(){
	DBG_ENTER("Frame.new")
	c_Frame *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<18>");
	return this;
}
void c_Frame::mark(){
	Object::mark();
}
String c_Frame::debug(){
	String t="(Frame)\n";
	t+=dbg_decl("x",&m_x);
	t+=dbg_decl("y",&m_y);
	return t;
}
c_Image* bb_graphics_LoadImage(String t_path,int t_frameCount,int t_flags){
	DBG_ENTER("LoadImage")
	DBG_LOCAL(t_path,"path")
	DBG_LOCAL(t_frameCount,"frameCount")
	DBG_LOCAL(t_flags,"flags")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<244>");
	gxtkSurface* t_surf=bb_graphics_device->LoadSurface(bb_data_FixDataPath(t_path));
	DBG_LOCAL(t_surf,"surf")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<245>");
	if((t_surf)!=0){
		DBG_BLOCK();
		c_Image* t_=((new c_Image)->m_new())->p_Init2(t_surf,t_frameCount,t_flags);
		return t_;
	}
	return 0;
}
c_Image* bb_graphics_LoadImage2(String t_path,int t_frameWidth,int t_frameHeight,int t_frameCount,int t_flags){
	DBG_ENTER("LoadImage")
	DBG_LOCAL(t_path,"path")
	DBG_LOCAL(t_frameWidth,"frameWidth")
	DBG_LOCAL(t_frameHeight,"frameHeight")
	DBG_LOCAL(t_frameCount,"frameCount")
	DBG_LOCAL(t_flags,"flags")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<249>");
	gxtkSurface* t_surf=bb_graphics_device->LoadSurface(bb_data_FixDataPath(t_path));
	DBG_LOCAL(t_surf,"surf")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<250>");
	if((t_surf)!=0){
		DBG_BLOCK();
		c_Image* t_=((new c_Image)->m_new())->p_Init3(t_surf,0,0,t_frameWidth,t_frameHeight,t_frameCount,t_flags,0,0,0,t_surf->Width(),t_surf->Height());
		return t_;
	}
	return 0;
}
int bb_graphics_SetFont(c_Image* t_font,int t_firstChar){
	DBG_ENTER("SetFont")
	DBG_LOCAL(t_font,"font")
	DBG_LOCAL(t_firstChar,"firstChar")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<551>");
	if(!((t_font)!=0)){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<552>");
		if(!((bb_graphics_context->m_defaultFont)!=0)){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<553>");
			gc_assign(bb_graphics_context->m_defaultFont,bb_graphics_LoadImage(String(L"mojo_font.png",13),96,2));
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<555>");
		t_font=bb_graphics_context->m_defaultFont;
		DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<556>");
		t_firstChar=32;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<558>");
	gc_assign(bb_graphics_context->m_font,t_font);
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<559>");
	bb_graphics_context->m_firstChar=t_firstChar;
	return 0;
}
gxtkAudio* bb_audio_device;
int bb_audio_SetAudioDevice(gxtkAudio* t_dev){
	DBG_ENTER("SetAudioDevice")
	DBG_LOCAL(t_dev,"dev")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/audio.monkey<22>");
	gc_assign(bb_audio_device,t_dev);
	return 0;
}
c_InputDevice::c_InputDevice(){
	m__joyStates=Array<c_JoyState* >(4);
	m__keyDown=Array<bool >(512);
	m__keyHitPut=0;
	m__keyHitQueue=Array<int >(33);
	m__keyHit=Array<int >(512);
	m__charGet=0;
	m__charPut=0;
	m__charQueue=Array<int >(32);
	m__mouseX=FLOAT(.0);
	m__mouseY=FLOAT(.0);
	m__touchX=Array<Float >(32);
	m__touchY=Array<Float >(32);
	m__accelX=FLOAT(.0);
	m__accelY=FLOAT(.0);
	m__accelZ=FLOAT(.0);
}
c_InputDevice* c_InputDevice::m_new(){
	DBG_ENTER("InputDevice.new")
	c_InputDevice *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<26>");
	for(int t_i=0;t_i<4;t_i=t_i+1){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<27>");
		gc_assign(m__joyStates.At(t_i),(new c_JoyState)->m_new());
	}
	return this;
}
void c_InputDevice::p_PutKeyHit(int t_key){
	DBG_ENTER("InputDevice.PutKeyHit")
	c_InputDevice *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_key,"key")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<237>");
	if(m__keyHitPut==m__keyHitQueue.Length()){
		DBG_BLOCK();
		return;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<238>");
	m__keyHit.At(t_key)+=1;
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<239>");
	m__keyHitQueue.At(m__keyHitPut)=t_key;
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<240>");
	m__keyHitPut+=1;
}
void c_InputDevice::p_BeginUpdate(){
	DBG_ENTER("InputDevice.BeginUpdate")
	c_InputDevice *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<189>");
	for(int t_i=0;t_i<4;t_i=t_i+1){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<190>");
		c_JoyState* t_state=m__joyStates.At(t_i);
		DBG_LOCAL(t_state,"state")
		DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<191>");
		if(!BBGame::Game()->PollJoystick(t_i,t_state->m_joyx,t_state->m_joyy,t_state->m_joyz,t_state->m_buttons)){
			DBG_BLOCK();
			break;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<192>");
		for(int t_j=0;t_j<32;t_j=t_j+1){
			DBG_BLOCK();
			DBG_LOCAL(t_j,"j")
			DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<193>");
			int t_key=256+t_i*32+t_j;
			DBG_LOCAL(t_key,"key")
			DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<194>");
			if(t_state->m_buttons.At(t_j)){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<195>");
				if(!m__keyDown.At(t_key)){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<196>");
					m__keyDown.At(t_key)=true;
					DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<197>");
					p_PutKeyHit(t_key);
				}
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<200>");
				m__keyDown.At(t_key)=false;
			}
		}
	}
}
void c_InputDevice::p_EndUpdate(){
	DBG_ENTER("InputDevice.EndUpdate")
	c_InputDevice *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<207>");
	for(int t_i=0;t_i<m__keyHitPut;t_i=t_i+1){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<208>");
		m__keyHit.At(m__keyHitQueue.At(t_i))=0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<210>");
	m__keyHitPut=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<211>");
	m__charGet=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<212>");
	m__charPut=0;
}
void c_InputDevice::p_KeyEvent(int t_event,int t_data){
	DBG_ENTER("InputDevice.KeyEvent")
	c_InputDevice *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_event,"event")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<111>");
	int t_1=t_event;
	DBG_LOCAL(t_1,"1")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<112>");
	if(t_1==1){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<113>");
		if(!m__keyDown.At(t_data)){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<114>");
			m__keyDown.At(t_data)=true;
			DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<115>");
			p_PutKeyHit(t_data);
			DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<116>");
			if(t_data==1){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<117>");
				m__keyDown.At(384)=true;
				DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<118>");
				p_PutKeyHit(384);
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<119>");
				if(t_data==384){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<120>");
					m__keyDown.At(1)=true;
					DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<121>");
					p_PutKeyHit(1);
				}
			}
		}
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<124>");
		if(t_1==2){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<125>");
			if(m__keyDown.At(t_data)){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<126>");
				m__keyDown.At(t_data)=false;
				DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<127>");
				if(t_data==1){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<128>");
					m__keyDown.At(384)=false;
				}else{
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<129>");
					if(t_data==384){
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<130>");
						m__keyDown.At(1)=false;
					}
				}
			}
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<133>");
			if(t_1==3){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<134>");
				if(m__charPut<m__charQueue.Length()){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<135>");
					m__charQueue.At(m__charPut)=t_data;
					DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<136>");
					m__charPut+=1;
				}
			}
		}
	}
}
void c_InputDevice::p_MouseEvent(int t_event,int t_data,Float t_x,Float t_y){
	DBG_ENTER("InputDevice.MouseEvent")
	c_InputDevice *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_event,"event")
	DBG_LOCAL(t_data,"data")
	DBG_LOCAL(t_x,"x")
	DBG_LOCAL(t_y,"y")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<142>");
	int t_2=t_event;
	DBG_LOCAL(t_2,"2")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<143>");
	if(t_2==4){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<144>");
		p_KeyEvent(1,1+t_data);
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<145>");
		if(t_2==5){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<146>");
			p_KeyEvent(2,1+t_data);
			return;
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<148>");
			if(t_2==6){
				DBG_BLOCK();
			}else{
				DBG_BLOCK();
				return;
			}
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<152>");
	m__mouseX=t_x;
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<153>");
	m__mouseY=t_y;
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<154>");
	m__touchX.At(0)=t_x;
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<155>");
	m__touchY.At(0)=t_y;
}
void c_InputDevice::p_TouchEvent(int t_event,int t_data,Float t_x,Float t_y){
	DBG_ENTER("InputDevice.TouchEvent")
	c_InputDevice *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_event,"event")
	DBG_LOCAL(t_data,"data")
	DBG_LOCAL(t_x,"x")
	DBG_LOCAL(t_y,"y")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<159>");
	int t_3=t_event;
	DBG_LOCAL(t_3,"3")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<160>");
	if(t_3==7){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<161>");
		p_KeyEvent(1,384+t_data);
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<162>");
		if(t_3==8){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<163>");
			p_KeyEvent(2,384+t_data);
			return;
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<165>");
			if(t_3==9){
				DBG_BLOCK();
			}else{
				DBG_BLOCK();
				return;
			}
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<169>");
	m__touchX.At(t_data)=t_x;
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<170>");
	m__touchY.At(t_data)=t_y;
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<171>");
	if(t_data==0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<172>");
		m__mouseX=t_x;
		DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<173>");
		m__mouseY=t_y;
	}
}
void c_InputDevice::p_MotionEvent(int t_event,int t_data,Float t_x,Float t_y,Float t_z){
	DBG_ENTER("InputDevice.MotionEvent")
	c_InputDevice *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_event,"event")
	DBG_LOCAL(t_data,"data")
	DBG_LOCAL(t_x,"x")
	DBG_LOCAL(t_y,"y")
	DBG_LOCAL(t_z,"z")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<178>");
	int t_4=t_event;
	DBG_LOCAL(t_4,"4")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<179>");
	if(t_4==10){
		DBG_BLOCK();
	}else{
		DBG_BLOCK();
		return;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<183>");
	m__accelX=t_x;
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<184>");
	m__accelY=t_y;
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<185>");
	m__accelZ=t_z;
}
int c_InputDevice::p_KeyHit(int t_key){
	DBG_ENTER("InputDevice.KeyHit")
	c_InputDevice *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_key,"key")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<52>");
	if(t_key>0 && t_key<512){
		DBG_BLOCK();
		return m__keyHit.At(t_key);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<53>");
	return 0;
}
bool c_InputDevice::p_KeyDown(int t_key){
	DBG_ENTER("InputDevice.KeyDown")
	c_InputDevice *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_key,"key")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<47>");
	if(t_key>0 && t_key<512){
		DBG_BLOCK();
		return m__keyDown.At(t_key);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<48>");
	return false;
}
Float c_InputDevice::p_TouchX(int t_index){
	DBG_ENTER("InputDevice.TouchX")
	c_InputDevice *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_index,"index")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<77>");
	if(t_index>=0 && t_index<32){
		DBG_BLOCK();
		return m__touchX.At(t_index);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<78>");
	return FLOAT(0.0);
}
Float c_InputDevice::p_TouchY(int t_index){
	DBG_ENTER("InputDevice.TouchY")
	c_InputDevice *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_index,"index")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<82>");
	if(t_index>=0 && t_index<32){
		DBG_BLOCK();
		return m__touchY.At(t_index);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<83>");
	return FLOAT(0.0);
}
void c_InputDevice::mark(){
	Object::mark();
	gc_mark_q(m__joyStates);
	gc_mark_q(m__keyDown);
	gc_mark_q(m__keyHitQueue);
	gc_mark_q(m__keyHit);
	gc_mark_q(m__charQueue);
	gc_mark_q(m__touchX);
	gc_mark_q(m__touchY);
}
String c_InputDevice::debug(){
	String t="(InputDevice)\n";
	t+=dbg_decl("_keyDown",&m__keyDown);
	t+=dbg_decl("_keyHit",&m__keyHit);
	t+=dbg_decl("_keyHitQueue",&m__keyHitQueue);
	t+=dbg_decl("_keyHitPut",&m__keyHitPut);
	t+=dbg_decl("_charQueue",&m__charQueue);
	t+=dbg_decl("_charPut",&m__charPut);
	t+=dbg_decl("_charGet",&m__charGet);
	t+=dbg_decl("_mouseX",&m__mouseX);
	t+=dbg_decl("_mouseY",&m__mouseY);
	t+=dbg_decl("_touchX",&m__touchX);
	t+=dbg_decl("_touchY",&m__touchY);
	t+=dbg_decl("_accelX",&m__accelX);
	t+=dbg_decl("_accelY",&m__accelY);
	t+=dbg_decl("_accelZ",&m__accelZ);
	t+=dbg_decl("_joyStates",&m__joyStates);
	return t;
}
c_JoyState::c_JoyState(){
	m_joyx=Array<Float >(2);
	m_joyy=Array<Float >(2);
	m_joyz=Array<Float >(2);
	m_buttons=Array<bool >(32);
}
c_JoyState* c_JoyState::m_new(){
	DBG_ENTER("JoyState.new")
	c_JoyState *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/inputdevice.monkey<14>");
	return this;
}
void c_JoyState::mark(){
	Object::mark();
	gc_mark_q(m_joyx);
	gc_mark_q(m_joyy);
	gc_mark_q(m_joyz);
	gc_mark_q(m_buttons);
}
String c_JoyState::debug(){
	String t="(JoyState)\n";
	t+=dbg_decl("joyx",&m_joyx);
	t+=dbg_decl("joyy",&m_joyy);
	t+=dbg_decl("joyz",&m_joyz);
	t+=dbg_decl("buttons",&m_buttons);
	return t;
}
c_InputDevice* bb_input_device;
int bb_input_SetInputDevice(c_InputDevice* t_dev){
	DBG_ENTER("SetInputDevice")
	DBG_LOCAL(t_dev,"dev")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/input.monkey<22>");
	gc_assign(bb_input_device,t_dev);
	return 0;
}
int bb_app2__devWidth;
int bb_app2__devHeight;
void bb_app2_ValidateDeviceWindow(bool t_notifyApp){
	DBG_ENTER("ValidateDeviceWindow")
	DBG_LOCAL(t_notifyApp,"notifyApp")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<57>");
	int t_w=bb_app2__game->GetDeviceWidth();
	DBG_LOCAL(t_w,"w")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<58>");
	int t_h=bb_app2__game->GetDeviceHeight();
	DBG_LOCAL(t_h,"h")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<59>");
	if(t_w==bb_app2__devWidth && t_h==bb_app2__devHeight){
		DBG_BLOCK();
		return;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<60>");
	bb_app2__devWidth=t_w;
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<61>");
	bb_app2__devHeight=t_h;
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<62>");
	if(t_notifyApp){
		DBG_BLOCK();
		bb_app2__app->p_OnResize();
	}
}
c_DisplayMode::c_DisplayMode(){
	m__width=0;
	m__height=0;
}
c_DisplayMode* c_DisplayMode::m_new(int t_width,int t_height){
	DBG_ENTER("DisplayMode.new")
	c_DisplayMode *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_width,"width")
	DBG_LOCAL(t_height,"height")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<192>");
	m__width=t_width;
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<193>");
	m__height=t_height;
	return this;
}
c_DisplayMode* c_DisplayMode::m_new2(){
	DBG_ENTER("DisplayMode.new")
	c_DisplayMode *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<189>");
	return this;
}
void c_DisplayMode::mark(){
	Object::mark();
}
String c_DisplayMode::debug(){
	String t="(DisplayMode)\n";
	t+=dbg_decl("_width",&m__width);
	t+=dbg_decl("_height",&m__height);
	return t;
}
c_Map::c_Map(){
	m_root=0;
}
c_Map* c_Map::m_new(){
	DBG_ENTER("Map.new")
	c_Map *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<7>");
	return this;
}
c_Node* c_Map::p_FindNode(int t_key){
	DBG_ENTER("Map.FindNode")
	c_Map *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_key,"key")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<157>");
	c_Node* t_node=m_root;
	DBG_LOCAL(t_node,"node")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<159>");
	while((t_node)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<160>");
		int t_cmp=p_Compare(t_key,t_node->m_key);
		DBG_LOCAL(t_cmp,"cmp")
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<161>");
		if(t_cmp>0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<162>");
			t_node=t_node->m_right;
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<163>");
			if(t_cmp<0){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<164>");
				t_node=t_node->m_left;
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<166>");
				return t_node;
			}
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<169>");
	return t_node;
}
bool c_Map::p_Contains(int t_key){
	DBG_ENTER("Map.Contains")
	c_Map *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_key,"key")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<25>");
	bool t_=p_FindNode(t_key)!=0;
	return t_;
}
int c_Map::p_RotateLeft(c_Node* t_node){
	DBG_ENTER("Map.RotateLeft")
	c_Map *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_node,"node")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<251>");
	c_Node* t_child=t_node->m_right;
	DBG_LOCAL(t_child,"child")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<252>");
	gc_assign(t_node->m_right,t_child->m_left);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<253>");
	if((t_child->m_left)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<254>");
		gc_assign(t_child->m_left->m_parent,t_node);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<256>");
	gc_assign(t_child->m_parent,t_node->m_parent);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<257>");
	if((t_node->m_parent)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<258>");
		if(t_node==t_node->m_parent->m_left){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<259>");
			gc_assign(t_node->m_parent->m_left,t_child);
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<261>");
			gc_assign(t_node->m_parent->m_right,t_child);
		}
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<264>");
		gc_assign(m_root,t_child);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<266>");
	gc_assign(t_child->m_left,t_node);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<267>");
	gc_assign(t_node->m_parent,t_child);
	return 0;
}
int c_Map::p_RotateRight(c_Node* t_node){
	DBG_ENTER("Map.RotateRight")
	c_Map *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_node,"node")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<271>");
	c_Node* t_child=t_node->m_left;
	DBG_LOCAL(t_child,"child")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<272>");
	gc_assign(t_node->m_left,t_child->m_right);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<273>");
	if((t_child->m_right)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<274>");
		gc_assign(t_child->m_right->m_parent,t_node);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<276>");
	gc_assign(t_child->m_parent,t_node->m_parent);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<277>");
	if((t_node->m_parent)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<278>");
		if(t_node==t_node->m_parent->m_right){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<279>");
			gc_assign(t_node->m_parent->m_right,t_child);
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<281>");
			gc_assign(t_node->m_parent->m_left,t_child);
		}
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<284>");
		gc_assign(m_root,t_child);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<286>");
	gc_assign(t_child->m_right,t_node);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<287>");
	gc_assign(t_node->m_parent,t_child);
	return 0;
}
int c_Map::p_InsertFixup(c_Node* t_node){
	DBG_ENTER("Map.InsertFixup")
	c_Map *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_node,"node")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<212>");
	while(((t_node->m_parent)!=0) && t_node->m_parent->m_color==-1 && ((t_node->m_parent->m_parent)!=0)){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<213>");
		if(t_node->m_parent==t_node->m_parent->m_parent->m_left){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<214>");
			c_Node* t_uncle=t_node->m_parent->m_parent->m_right;
			DBG_LOCAL(t_uncle,"uncle")
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<215>");
			if(((t_uncle)!=0) && t_uncle->m_color==-1){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<216>");
				t_node->m_parent->m_color=1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<217>");
				t_uncle->m_color=1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<218>");
				t_uncle->m_parent->m_color=-1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<219>");
				t_node=t_uncle->m_parent;
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<221>");
				if(t_node==t_node->m_parent->m_right){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<222>");
					t_node=t_node->m_parent;
					DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<223>");
					p_RotateLeft(t_node);
				}
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<225>");
				t_node->m_parent->m_color=1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<226>");
				t_node->m_parent->m_parent->m_color=-1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<227>");
				p_RotateRight(t_node->m_parent->m_parent);
			}
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<230>");
			c_Node* t_uncle2=t_node->m_parent->m_parent->m_left;
			DBG_LOCAL(t_uncle2,"uncle")
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<231>");
			if(((t_uncle2)!=0) && t_uncle2->m_color==-1){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<232>");
				t_node->m_parent->m_color=1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<233>");
				t_uncle2->m_color=1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<234>");
				t_uncle2->m_parent->m_color=-1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<235>");
				t_node=t_uncle2->m_parent;
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<237>");
				if(t_node==t_node->m_parent->m_left){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<238>");
					t_node=t_node->m_parent;
					DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<239>");
					p_RotateRight(t_node);
				}
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<241>");
				t_node->m_parent->m_color=1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<242>");
				t_node->m_parent->m_parent->m_color=-1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<243>");
				p_RotateLeft(t_node->m_parent->m_parent);
			}
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<247>");
	m_root->m_color=1;
	return 0;
}
bool c_Map::p_Set(int t_key,c_DisplayMode* t_value){
	DBG_ENTER("Map.Set")
	c_Map *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_key,"key")
	DBG_LOCAL(t_value,"value")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<29>");
	c_Node* t_node=m_root;
	DBG_LOCAL(t_node,"node")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<30>");
	c_Node* t_parent=0;
	int t_cmp=0;
	DBG_LOCAL(t_parent,"parent")
	DBG_LOCAL(t_cmp,"cmp")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<32>");
	while((t_node)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<33>");
		t_parent=t_node;
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<34>");
		t_cmp=p_Compare(t_key,t_node->m_key);
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<35>");
		if(t_cmp>0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<36>");
			t_node=t_node->m_right;
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<37>");
			if(t_cmp<0){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<38>");
				t_node=t_node->m_left;
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<40>");
				gc_assign(t_node->m_value,t_value);
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<41>");
				return false;
			}
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<45>");
	t_node=(new c_Node)->m_new(t_key,t_value,-1,t_parent);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<47>");
	if((t_parent)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<48>");
		if(t_cmp>0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<49>");
			gc_assign(t_parent->m_right,t_node);
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<51>");
			gc_assign(t_parent->m_left,t_node);
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<53>");
		p_InsertFixup(t_node);
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<55>");
		gc_assign(m_root,t_node);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<57>");
	return true;
}
bool c_Map::p_Insert(int t_key,c_DisplayMode* t_value){
	DBG_ENTER("Map.Insert")
	c_Map *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_key,"key")
	DBG_LOCAL(t_value,"value")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<126>");
	bool t_=p_Set(t_key,t_value);
	return t_;
}
void c_Map::mark(){
	Object::mark();
	gc_mark_q(m_root);
}
String c_Map::debug(){
	String t="(Map)\n";
	t+=dbg_decl("root",&m_root);
	return t;
}
c_IntMap::c_IntMap(){
}
c_IntMap* c_IntMap::m_new(){
	DBG_ENTER("IntMap.new")
	c_IntMap *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<534>");
	c_Map::m_new();
	return this;
}
int c_IntMap::p_Compare(int t_lhs,int t_rhs){
	DBG_ENTER("IntMap.Compare")
	c_IntMap *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_lhs,"lhs")
	DBG_LOCAL(t_rhs,"rhs")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<537>");
	int t_=t_lhs-t_rhs;
	return t_;
}
void c_IntMap::mark(){
	c_Map::mark();
}
String c_IntMap::debug(){
	String t="(IntMap)\n";
	t=c_Map::debug()+t;
	return t;
}
c_Stack::c_Stack(){
	m_data=Array<c_DisplayMode* >();
	m_length=0;
}
c_Stack* c_Stack::m_new(){
	DBG_ENTER("Stack.new")
	c_Stack *self=this;
	DBG_LOCAL(self,"Self")
	return this;
}
c_Stack* c_Stack::m_new2(Array<c_DisplayMode* > t_data){
	DBG_ENTER("Stack.new")
	c_Stack *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<13>");
	gc_assign(this->m_data,t_data.Slice(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<14>");
	this->m_length=t_data.Length();
	return this;
}
void c_Stack::p_Push(c_DisplayMode* t_value){
	DBG_ENTER("Stack.Push")
	c_Stack *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_value,"value")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<67>");
	if(m_length==m_data.Length()){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<68>");
		gc_assign(m_data,m_data.Resize(m_length*2+10));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<70>");
	gc_assign(m_data.At(m_length),t_value);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<71>");
	m_length+=1;
}
void c_Stack::p_Push2(Array<c_DisplayMode* > t_values,int t_offset,int t_count){
	DBG_ENTER("Stack.Push")
	c_Stack *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_values,"values")
	DBG_LOCAL(t_offset,"offset")
	DBG_LOCAL(t_count,"count")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<79>");
	for(int t_i=0;t_i<t_count;t_i=t_i+1){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<80>");
		p_Push(t_values.At(t_offset+t_i));
	}
}
void c_Stack::p_Push3(Array<c_DisplayMode* > t_values,int t_offset){
	DBG_ENTER("Stack.Push")
	c_Stack *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_values,"values")
	DBG_LOCAL(t_offset,"offset")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<75>");
	p_Push2(t_values,t_offset,t_values.Length()-t_offset);
}
Array<c_DisplayMode* > c_Stack::p_ToArray(){
	DBG_ENTER("Stack.ToArray")
	c_Stack *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<18>");
	Array<c_DisplayMode* > t_t=Array<c_DisplayMode* >(m_length);
	DBG_LOCAL(t_t,"t")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<19>");
	for(int t_i=0;t_i<m_length;t_i=t_i+1){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<20>");
		gc_assign(t_t.At(t_i),m_data.At(t_i));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<22>");
	return t_t;
}
void c_Stack::mark(){
	Object::mark();
	gc_mark_q(m_data);
}
String c_Stack::debug(){
	String t="(Stack)\n";
	t+=dbg_decl("data",&m_data);
	t+=dbg_decl("length",&m_length);
	return t;
}
c_Node::c_Node(){
	m_key=0;
	m_right=0;
	m_left=0;
	m_value=0;
	m_color=0;
	m_parent=0;
}
c_Node* c_Node::m_new(int t_key,c_DisplayMode* t_value,int t_color,c_Node* t_parent){
	DBG_ENTER("Node.new")
	c_Node *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_key,"key")
	DBG_LOCAL(t_value,"value")
	DBG_LOCAL(t_color,"color")
	DBG_LOCAL(t_parent,"parent")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<364>");
	this->m_key=t_key;
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<365>");
	gc_assign(this->m_value,t_value);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<366>");
	this->m_color=t_color;
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<367>");
	gc_assign(this->m_parent,t_parent);
	return this;
}
c_Node* c_Node::m_new2(){
	DBG_ENTER("Node.new")
	c_Node *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<361>");
	return this;
}
void c_Node::mark(){
	Object::mark();
	gc_mark_q(m_right);
	gc_mark_q(m_left);
	gc_mark_q(m_value);
	gc_mark_q(m_parent);
}
String c_Node::debug(){
	String t="(Node)\n";
	t+=dbg_decl("key",&m_key);
	t+=dbg_decl("value",&m_value);
	t+=dbg_decl("color",&m_color);
	t+=dbg_decl("parent",&m_parent);
	t+=dbg_decl("left",&m_left);
	t+=dbg_decl("right",&m_right);
	return t;
}
Array<c_DisplayMode* > bb_app2__displayModes;
c_DisplayMode* bb_app2__desktopMode;
int bb_app2_DeviceWidth(){
	DBG_ENTER("DeviceWidth")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<263>");
	return bb_app2__devWidth;
}
int bb_app2_DeviceHeight(){
	DBG_ENTER("DeviceHeight")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<267>");
	return bb_app2__devHeight;
}
void bb_app2_EnumDisplayModes(){
	DBG_ENTER("EnumDisplayModes")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<33>");
	Array<BBDisplayMode* > t_modes=bb_app2__game->GetDisplayModes();
	DBG_LOCAL(t_modes,"modes")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<34>");
	c_IntMap* t_mmap=(new c_IntMap)->m_new();
	DBG_LOCAL(t_mmap,"mmap")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<35>");
	c_Stack* t_mstack=(new c_Stack)->m_new();
	DBG_LOCAL(t_mstack,"mstack")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<36>");
	for(int t_i=0;t_i<t_modes.Length();t_i=t_i+1){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<37>");
		int t_w=t_modes.At(t_i)->width;
		DBG_LOCAL(t_w,"w")
		DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<38>");
		int t_h=t_modes.At(t_i)->height;
		DBG_LOCAL(t_h,"h")
		DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<39>");
		int t_size=t_w<<16|t_h;
		DBG_LOCAL(t_size,"size")
		DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<40>");
		if(t_mmap->p_Contains(t_size)){
			DBG_BLOCK();
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<42>");
			c_DisplayMode* t_mode=(new c_DisplayMode)->m_new(t_modes.At(t_i)->width,t_modes.At(t_i)->height);
			DBG_LOCAL(t_mode,"mode")
			DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<43>");
			t_mmap->p_Insert(t_size,t_mode);
			DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<44>");
			t_mstack->p_Push(t_mode);
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<47>");
	gc_assign(bb_app2__displayModes,t_mstack->p_ToArray());
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<48>");
	BBDisplayMode* t_mode2=bb_app2__game->GetDesktopMode();
	DBG_LOCAL(t_mode2,"mode")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<49>");
	if((t_mode2)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<50>");
		gc_assign(bb_app2__desktopMode,(new c_DisplayMode)->m_new(t_mode2->width,t_mode2->height));
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<52>");
		gc_assign(bb_app2__desktopMode,(new c_DisplayMode)->m_new(bb_app2_DeviceWidth(),bb_app2_DeviceHeight()));
	}
}
gxtkGraphics* bb_graphics_renderDevice;
int bb_graphics_SetMatrix(Float t_ix,Float t_iy,Float t_jx,Float t_jy,Float t_tx,Float t_ty){
	DBG_ENTER("SetMatrix")
	DBG_LOCAL(t_ix,"ix")
	DBG_LOCAL(t_iy,"iy")
	DBG_LOCAL(t_jx,"jx")
	DBG_LOCAL(t_jy,"jy")
	DBG_LOCAL(t_tx,"tx")
	DBG_LOCAL(t_ty,"ty")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<317>");
	bb_graphics_context->m_ix=t_ix;
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<318>");
	bb_graphics_context->m_iy=t_iy;
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<319>");
	bb_graphics_context->m_jx=t_jx;
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<320>");
	bb_graphics_context->m_jy=t_jy;
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<321>");
	bb_graphics_context->m_tx=t_tx;
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<322>");
	bb_graphics_context->m_ty=t_ty;
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<323>");
	bb_graphics_context->m_tformed=((t_ix!=FLOAT(1.0) || t_iy!=FLOAT(0.0) || t_jx!=FLOAT(0.0) || t_jy!=FLOAT(1.0) || t_tx!=FLOAT(0.0) || t_ty!=FLOAT(0.0))?1:0);
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<324>");
	bb_graphics_context->m_matDirty=1;
	return 0;
}
int bb_graphics_SetMatrix2(Array<Float > t_m){
	DBG_ENTER("SetMatrix")
	DBG_LOCAL(t_m,"m")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<313>");
	bb_graphics_SetMatrix(t_m.At(0),t_m.At(1),t_m.At(2),t_m.At(3),t_m.At(4),t_m.At(5));
	return 0;
}
int bb_graphics_SetColor(Float t_r,Float t_g,Float t_b){
	DBG_ENTER("SetColor")
	DBG_LOCAL(t_r,"r")
	DBG_LOCAL(t_g,"g")
	DBG_LOCAL(t_b,"b")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<259>");
	bb_graphics_context->m_color_r=t_r;
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<260>");
	bb_graphics_context->m_color_g=t_g;
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<261>");
	bb_graphics_context->m_color_b=t_b;
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<262>");
	bb_graphics_renderDevice->SetColor(t_r,t_g,t_b);
	return 0;
}
int bb_graphics_SetAlpha(Float t_alpha){
	DBG_ENTER("SetAlpha")
	DBG_LOCAL(t_alpha,"alpha")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<276>");
	bb_graphics_context->m_alpha=t_alpha;
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<277>");
	bb_graphics_renderDevice->SetAlpha(t_alpha);
	return 0;
}
int bb_graphics_SetBlend(int t_blend){
	DBG_ENTER("SetBlend")
	DBG_LOCAL(t_blend,"blend")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<285>");
	bb_graphics_context->m_blend=t_blend;
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<286>");
	bb_graphics_renderDevice->SetBlend(t_blend);
	return 0;
}
int bb_graphics_SetScissor(Float t_x,Float t_y,Float t_width,Float t_height){
	DBG_ENTER("SetScissor")
	DBG_LOCAL(t_x,"x")
	DBG_LOCAL(t_y,"y")
	DBG_LOCAL(t_width,"width")
	DBG_LOCAL(t_height,"height")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<294>");
	bb_graphics_context->m_scissor_x=t_x;
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<295>");
	bb_graphics_context->m_scissor_y=t_y;
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<296>");
	bb_graphics_context->m_scissor_width=t_width;
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<297>");
	bb_graphics_context->m_scissor_height=t_height;
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<298>");
	bb_graphics_renderDevice->SetScissor(int(t_x),int(t_y),int(t_width),int(t_height));
	return 0;
}
int bb_graphics_BeginRender(){
	DBG_ENTER("BeginRender")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<220>");
	gc_assign(bb_graphics_renderDevice,bb_graphics_device);
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<221>");
	bb_graphics_context->m_matrixSp=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<222>");
	bb_graphics_SetMatrix(FLOAT(1.0),FLOAT(0.0),FLOAT(0.0),FLOAT(1.0),FLOAT(0.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<223>");
	bb_graphics_SetColor(FLOAT(255.0),FLOAT(255.0),FLOAT(255.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<224>");
	bb_graphics_SetAlpha(FLOAT(1.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<225>");
	bb_graphics_SetBlend(0);
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<226>");
	bb_graphics_SetScissor(FLOAT(0.0),FLOAT(0.0),Float(bb_app2_DeviceWidth()),Float(bb_app2_DeviceHeight()));
	return 0;
}
int bb_graphics_EndRender(){
	DBG_ENTER("EndRender")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<230>");
	bb_graphics_renderDevice=0;
	return 0;
}
c_BBGameEvent::c_BBGameEvent(){
}
void c_BBGameEvent::mark(){
	Object::mark();
}
String c_BBGameEvent::debug(){
	String t="(BBGameEvent)\n";
	return t;
}
void bb_app2_EndApp(){
	DBG_ENTER("EndApp")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<259>");
	bbError(String());
}
int bb_app2__updateRate;
void bb_app2_SetUpdateRate(int t_hertz){
	DBG_ENTER("SetUpdateRate")
	DBG_LOCAL(t_hertz,"hertz")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<224>");
	bb_app2__updateRate=t_hertz;
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<225>");
	bb_app2__game->SetUpdateRate(t_hertz);
}
c_TRender::c_TRender(){
}
c_TRender* c_TRender::m_new(){
	DBG_ENTER("TRender.new")
	c_TRender *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<28>");
	return this;
}
c_TRender* c_TRender::m_render;
c_List3* c_TRender::m_draw_list;
int c_TRender::m_tris_rendered;
int c_TRender::p_BindTextureStack(){
	DBG_ENTER("TRender.BindTextureStack")
	c_TRender *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<497>");
	c_Enumerator3* t_=c_TTexture::m_tex_bind_stack->p_ObjectEnumerator();
	while(t_->p_HasNext()){
		DBG_BLOCK();
		c_TTexture* t_tex=t_->p_NextObject();
		DBG_LOCAL(t_tex,"tex")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<498>");
		if(t_tex->m_bind_flags==-255){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<500>");
			m_render->p_DeleteTexture(t_tex);
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<501>");
			t_tex->p_FreeTexture_();
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<503>");
			m_render->p_BindTexture(t_tex,t_tex->m_bind_flags);
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<506>");
		t_tex->m_bind_flags=-1;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<510>");
	c_Enumerator3* t_2=c_TTexture::m_tex_bind_stack->p_ObjectEnumerator();
	while(t_2->p_HasNext()){
		DBG_BLOCK();
		c_TTexture* t_tex2=t_2->p_NextObject();
		DBG_LOCAL(t_tex2,"tex")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<511>");
		if(t_tex2->m_freeMemoryAfterBind){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<512>");
			t_tex2->m_pixmap->p_FreePixmap();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<513>");
			if(true){
				DBG_BLOCK();
				bbPrint(String(L"..freeTextureMemory:",20)+t_tex2->m_file);
			}
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<517>");
	c_TTexture::m_tex_bind_stack->p_Clear();
	return 0;
}
c_RenderAlphaList* c_TRender::m_render_list;
c_RenderAlphaList* c_TRender::m_render_alpha_list;
int c_TRender::m_wireframe;
void c_TRender::p_RenderCamera(c_TCamera* t_cam,int t_skip){
	DBG_ENTER("TRender.RenderCamera")
	c_TRender *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_cam,"cam")
	DBG_LOCAL(t_skip,"skip")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<357>");
	m_render->p_Reset();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<362>");
	if(!((t_skip)!=0)){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<364>");
		t_cam->p_Update2(t_cam);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<365>");
		p_UpdateCamera(t_cam);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<370>");
	c_Enumerator6* t_=c_TLight::m_light_list->p_ObjectEnumerator();
	while(t_->p_HasNext()){
		DBG_BLOCK();
		c_TLight* t_light=t_->p_NextObject();
		DBG_LOCAL(t_light,"light")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<372>");
		p_UpdateLight(t_cam,t_light);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<378>");
	m_render_list->p_Clear();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<379>");
	m_render_alpha_list->p_Clear();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<382>");
	c_TMesh* t_mesh=0;
	DBG_LOCAL(t_mesh,"mesh")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<383>");
	int t_alpha_count=0;
	DBG_LOCAL(t_alpha_count,"alpha_count")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<384>");
	int t_wireFrameIsEnabled=m_wireframe;
	DBG_LOCAL(t_wireFrameIsEnabled,"wireFrameIsEnabled")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<386>");
	c_Enumerator7* t_2=c_TEntity::m_entity_list->p_ObjectEnumerator();
	while(t_2->p_HasNext()){
		DBG_BLOCK();
		c_TEntity* t_ent=t_2->p_NextObject();
		DBG_LOCAL(t_ent,"ent")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<389>");
		t_mesh=dynamic_cast<c_TMesh*>(t_ent);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<391>");
		if((t_mesh)!=0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<394>");
			if(t_mesh->p_Hidden()==true || t_mesh->m_brush->m_alpha==FLOAT(0.0)){
				DBG_BLOCK();
				continue;
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<397>");
			if(t_mesh->m_use_cam_layer && t_mesh->m_cam_layer!=t_cam || t_cam->m_use_cam_layer && t_mesh->m_cam_layer!=t_cam){
				DBG_BLOCK();
				continue;
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<401>");
			t_mesh->p_GetBounds(false);
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<405>");
			Float t_inview=t_cam->p_EntityInFrustum(t_mesh);
			DBG_LOCAL(t_inview,"inview")
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<406>");
			t_mesh->m_distance_nearplane=t_inview;
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<411>");
			if(t_inview>FLOAT(0.00001)){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<413>");
				t_mesh->m_culled=false;
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<415>");
				m_wireframe=m_wireframe|((t_mesh->m_wireframe)?1:0);
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<417>");
				if(t_mesh->m_auto_fade==1){
					DBG_BLOCK();
					t_mesh->p_AutoFade(t_cam);
				}
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<419>");
				if((dynamic_cast<c_IRenderUpdate*>(t_mesh))!=0){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<421>");
					dynamic_cast<c_IRenderUpdate*>(t_mesh)->p_Update2(t_cam);
				}
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<425>");
				if(t_mesh->p_Alpha()){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<429>");
					t_mesh->m_alpha_order=t_mesh->m_distance_nearplane;
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<430>");
					m_render_alpha_list->p_AddLast3(t_mesh);
				}else{
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<434>");
					m_render->p_Render2((t_mesh),t_cam);
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<437>");
					m_tris_rendered+=t_mesh->m_total_tris;
				}
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<441>");
				m_wireframe=t_wireFrameIsEnabled;
			}
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<457>");
	m_render_alpha_list->p_Sort(1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<460>");
	c_Enumerator9* t_3=m_render_alpha_list->p_ObjectEnumerator();
	while(t_3->p_HasNext()){
		DBG_BLOCK();
		t_mesh=t_3->p_NextObject();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<462>");
		m_wireframe=m_wireframe|((t_mesh->m_wireframe)?1:0);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<464>");
		m_render->p_Render2((t_mesh),t_cam);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<466>");
		m_wireframe=t_wireFrameIsEnabled;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<468>");
		m_tris_rendered+=t_mesh->m_total_tris;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<474>");
	p_Finish();
}
c_TShader* c_TRender::m_temp_shader;
c_IShader2D* c_TRender::m_shader2D;
int c_TRender::m_alpha_pass;
c_TCamera* c_TRender::m_camera2D;
int c_TRender::m_width;
int c_TRender::m_height;
void c_TRender::m_RenderDrawList(){
	DBG_ENTER("TRender.RenderDrawList")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<296>");
	if(m_draw_list->p_IsEmpty() || !m_render->p_ContextReady()){
		DBG_BLOCK();
		return;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<299>");
	m_render->p_Reset();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<300>");
	m_shader2D->p_SetShader2D();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<305>");
	c_MojoEmulationDevice::m__quadCache->p_FlushCache();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<307>");
	m_alpha_pass=1;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<308>");
	int t_wireframeIsEnabled=m_wireframe;
	DBG_LOCAL(t_wireframeIsEnabled,"wireframeIsEnabled")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<309>");
	m_wireframe=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<313>");
	m_render->p_UpdateCamera(m_camera2D);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<316>");
	c_Enumerator9* t_=m_draw_list->p_ObjectEnumerator();
	while(t_->p_HasNext()){
		DBG_BLOCK();
		c_TMesh* t_mesh=t_->p_NextObject();
		DBG_LOCAL(t_mesh,"mesh")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<318>");
		if(!((t_mesh)!=0)){
			DBG_BLOCK();
			continue;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<320>");
		if((dynamic_cast<c_IRenderUpdate*>(t_mesh))!=0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<322>");
			dynamic_cast<c_IRenderUpdate*>(t_mesh)->p_Update2(m_camera2D);
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<327>");
		c_TSprite* t_sp=dynamic_cast<c_TSprite*>(t_mesh);
		DBG_LOCAL(t_sp,"sp")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<328>");
		if(t_mesh->m_is_sprite){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<329>");
			t_sp->m_mat_sp->p_Scale(t_sp->m_pixel_scale.At(0),t_sp->m_pixel_scale.At(1),FLOAT(1.0));
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<330>");
			t_mesh->p_EntityFX(64);
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<334>");
		if(t_mesh->p_Alpha()){
			DBG_BLOCK();
			t_mesh->m_alpha_order=FLOAT(1.0);
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<337>");
		m_render->p_Render2((t_mesh),m_camera2D);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<338>");
		m_tris_rendered+=t_mesh->m_total_tris;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<342>");
	m_wireframe=t_wireframeIsEnabled;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<344>");
	m_render->p_Finish();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<345>");
	m_draw_list->p_Clear();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<348>");
	m_camera2D->p_CameraClsMode(false,false);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<349>");
	m_camera2D->p_CameraViewport(0,0,m_width,m_height);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<350>");
	m_camera2D->p_SetPixelCamera();
}
void c_TRender::p_RenderWorldFinish(){
	DBG_ENTER("TRender.RenderWorldFinish")
	c_TRender *self=this;
	DBG_LOCAL(self,"Self")
}
void c_TRender::m_RenderWorld(){
	DBG_ENTER("TRender.RenderWorld")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<251>");
	m_tris_rendered=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<254>");
	if(m_render==0 || !m_render->p_ContextReady()){
		DBG_BLOCK();
		return;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<257>");
	if(c_TTexture::m_tex_bind_stack->p_Length2()>0){
		DBG_BLOCK();
		m_render->p_BindTextureStack();
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<260>");
	c_Enumerator4* t_=c_TCamera::m_cam_list->p_ObjectEnumerator();
	while(t_->p_HasNext()){
		DBG_BLOCK();
		c_TCamera* t_cam=t_->p_NextObject();
		DBG_LOCAL(t_cam,"cam")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<263>");
		if(t_cam->p_Hidden()==true){
			DBG_BLOCK();
			continue;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<265>");
		c_TShader::m_PreProcess(t_cam);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<269>");
		if(dynamic_cast<c_IShaderRender*>(c_TShader::m_g_shader)==0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<271>");
			m_render->p_RenderCamera(t_cam,0);
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<275>");
			gc_assign(m_temp_shader,c_TShader::m_g_shader);
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<277>");
			dynamic_cast<c_IShaderRender*>(c_TShader::m_g_shader)->p_Render3(t_cam);
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<279>");
			gc_assign(c_TShader::m_g_shader,m_temp_shader);
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<283>");
		c_TShader::m_PostProcess(t_cam);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<287>");
	m_RenderDrawList();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<289>");
	m_render->p_RenderWorldFinish();
}
bool c_TRender::m_vbo_enabled;
int c_TRender::m_MAX_TEXTURES;
int c_TRender::p_ClearErrors(){
	DBG_ENTER("TRender.ClearErrors")
	c_TRender *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<524>");
	return 1;
}
void c_TRender::mark(){
	Object::mark();
}
String c_TRender::debug(){
	String t="(TRender)\n";
	t+=dbg_decl("render",&c_TRender::m_render);
	t+=dbg_decl("vbo_enabled",&c_TRender::m_vbo_enabled);
	t+=dbg_decl("MAX_TEXTURES",&c_TRender::m_MAX_TEXTURES);
	t+=dbg_decl("width",&c_TRender::m_width);
	t+=dbg_decl("height",&c_TRender::m_height);
	t+=dbg_decl("wireframe",&c_TRender::m_wireframe);
	t+=dbg_decl("alpha_pass",&c_TRender::m_alpha_pass);
	t+=dbg_decl("shader2D",&c_TRender::m_shader2D);
	t+=dbg_decl("camera2D",&c_TRender::m_camera2D);
	t+=dbg_decl("draw_list",&c_TRender::m_draw_list);
	t+=dbg_decl("tris_rendered",&c_TRender::m_tris_rendered);
	t+=dbg_decl("render_list",&c_TRender::m_render_list);
	t+=dbg_decl("render_alpha_list",&c_TRender::m_render_alpha_list);
	t+=dbg_decl("temp_shader",&c_TRender::m_temp_shader);
	return t;
}
c_OpenglES11::c_OpenglES11(){
	m_last_effect=(new c_EffectState)->m_new();
	m_effect=(new c_EffectState)->m_new();
	m_slice_pos=0;
	m_slice_norm=0;
	m_slice_color=0;
	m_t_array=Array<Float >(16);
}
c_OpenglES11* c_OpenglES11::m_new(){
	DBG_ENTER("OpenglES11.new")
	c_OpenglES11 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<112>");
	c_TRender::m_new();
	return this;
}
bool c_OpenglES11::p_ContextReady(){
	DBG_ENTER("OpenglES11.ContextReady")
	c_OpenglES11 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<118>");
	return true;
}
c_TTexture* c_OpenglES11::m_last_texture;
c_TSurface* c_OpenglES11::m_last_sprite;
int c_OpenglES11::m_last_tex_count;
bool c_OpenglES11::m__useMojo;
void c_OpenglES11::p_Reset(){
	DBG_ENTER("OpenglES11.Reset")
	c_OpenglES11 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<152>");
	m_last_texture=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<153>");
	m_last_sprite=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<154>");
	m_last_tex_count=8;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<155>");
	c_TRender::m_alpha_pass=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<156>");
	m_last_effect->p_SetNull();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<158>");
	if(m__useMojo){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<159>");
		glEnable(2929);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<160>");
		glEnable(2884);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<161>");
		glEnable(2896);
	}
}
c_SurfaceAlphaList* c_OpenglES11::m_alpha_list;
int c_OpenglES11::m_count1280error;
int c_OpenglES11::m_GetGLError(){
	DBG_ENTER("OpenglES11.GetGLError")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<979>");
	if(true){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<980>");
		int t_gle=glGetError();
		DBG_LOCAL(t_gle,"gle")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<983>");
		if(t_gle==1280){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<984>");
			if(m_count1280error>3){
				DBG_BLOCK();
				return 0;
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<985>");
			m_count1280error+=1;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<988>");
		if(t_gle!=0){
			DBG_BLOCK();
			bbPrint(String(L"**glerror: ",11)+String(t_gle));
			return 1;
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<990>");
	return 0;
}
int c_OpenglES11::p_UpdateVBO(c_TSurface* t_surf){
	DBG_ENTER("OpenglES11.UpdateVBO")
	c_OpenglES11 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_surf,"surf")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1004>");
	if(t_surf->m_vbo_id.At(0)==0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1005>");
		_glGenBuffers(6,t_surf->m_vbo_id,0);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1008>");
	if(t_surf->m_reset_vbo==-1){
		DBG_BLOCK();
		t_surf->m_reset_vbo=255;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1010>");
	if(t_surf->m_vbo_id.At(0)==0){
		DBG_BLOCK();
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1014>");
	if(((t_surf->m_reset_vbo&1)!=0) || ((t_surf->m_reset_vbo&2)!=0) || ((t_surf->m_reset_vbo&4)!=0) || ((t_surf->m_reset_vbo&8)!=0)){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1017>");
		if(t_surf->m_vbo_dyn && !((t_surf->m_vert_anim).Length()!=0)){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1018>");
			glBindBuffer(34962,t_surf->m_vbo_id.At(0));
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1019>");
			if(t_surf->m_reset_vbo!=255){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1020>");
				_glBufferSubData(34962,0,t_surf->m_no_verts*64,t_surf->m_vert_data->m_buf);
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1022>");
				_glBufferData(34962,t_surf->m_no_verts*64,t_surf->m_vert_data->m_buf,35048);
			}
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1025>");
			if(t_surf->m_vbo_dyn && ((t_surf->m_vert_anim).Length()!=0) && ((t_surf->m_reset_vbo&1)!=0)){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1027>");
				glBindBuffer(34962,t_surf->m_vbo_id.At(4));
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1028>");
				if(t_surf->m_reset_vbo!=255){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1030>");
					_glBufferSubData(34962,0,t_surf->m_no_verts*12,t_surf->m_vert_anim.At(t_surf->m_anim_frame)->m_buf);
				}else{
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1032>");
					_glBufferData(34962,t_surf->m_no_verts*12,t_surf->m_vert_anim.At(t_surf->m_anim_frame)->m_buf,35048);
				}
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1039>");
				glBindBuffer(34962,t_surf->m_vbo_id.At(0));
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1040>");
				_glBufferData(34962,t_surf->m_no_verts*64,t_surf->m_vert_data->m_buf,35044);
			}
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1045>");
	if((t_surf->m_reset_vbo&16)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1046>");
		glBindBuffer(34963,t_surf->m_vbo_id.At(5));
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1047>");
		if(t_surf->m_reset_vbo!=255){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1048>");
			_glBufferSubData(34963,0,t_surf->m_no_tris*6,t_surf->m_tris->m_buf);
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1050>");
			_glBufferData(34963,t_surf->m_no_tris*6,t_surf->m_tris->m_buf,35044);
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1055>");
	if(true && ((m_GetGLError())!=0)){
		DBG_BLOCK();
		bbPrint(String(L"**glerror: vbo update",21));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1058>");
	t_surf->m_reset_vbo=0;
	return 0;
}
void c_OpenglES11::p_Render2(c_TEntity* t_ent,c_TCamera* t_cam){
	DBG_ENTER("OpenglES11.Render")
	c_OpenglES11 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_ent,"ent")
	DBG_LOCAL(t_cam,"cam")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<169>");
	c_TMesh* t_mesh=dynamic_cast<c_TMesh*>(t_ent);
	DBG_LOCAL(t_mesh,"mesh")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<171>");
	if(!((t_mesh)!=0)){
		DBG_BLOCK();
		return;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<172>");
	if(t_mesh->m_no_surfs==0){
		DBG_BLOCK();
		return;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<174>");
	String t_name=t_ent->p_EntityName();
	DBG_LOCAL(t_name,"name")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<176>");
	int t_fog=0;
	DBG_LOCAL(t_fog,"fog")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<182>");
	c_TSurface* t_anim_surf2=0;
	DBG_LOCAL(t_anim_surf2,"anim_surf2")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<183>");
	int t_ccc=0;
	DBG_LOCAL(t_ccc,"ccc")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<186>");
	c_List2* t_temp_list=t_mesh->m_surf_list;
	DBG_LOCAL(t_temp_list,"temp_list")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<187>");
	m_alpha_list->p_Clear();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<191>");
	for(int t_alphaloop=c_TRender::m_alpha_pass;t_alphaloop<=1;t_alphaloop=t_alphaloop+1){
		DBG_BLOCK();
		DBG_LOCAL(t_alphaloop,"alphaloop")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<193>");
		c_Enumerator8* t_=t_temp_list->p_ObjectEnumerator();
		while(t_->p_HasNext()){
			DBG_BLOCK();
			c_TSurface* t_surf=t_->p_NextObject();
			DBG_LOCAL(t_surf,"surf")
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<194>");
			t_ccc+=1;
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<199>");
			if(t_surf->m_no_verts==0){
				DBG_BLOCK();
				continue;
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<200>");
			if(t_surf->m_alpha_enable && t_alphaloop<1){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<202>");
				m_alpha_list->p_AddLast2(t_surf);
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<203>");
				continue;
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<208>");
			bool t_skip_sprite_state=false;
			DBG_LOCAL(t_skip_sprite_state,"skip_sprite_state")
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<209>");
			if(m_last_sprite==t_surf){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<210>");
				t_skip_sprite_state=true;
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<212>");
				gc_assign(m_last_sprite,t_surf);
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<224>");
			int t_vbo=0;
			DBG_LOCAL(t_vbo,"vbo")
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<226>");
			if(c_TRender::m_vbo_enabled){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<227>");
				t_vbo=1;
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<230>");
				if(t_surf->m_vbo_id.At(0)!=0){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<231>");
					_glDeleteBuffers(6,t_surf->m_vbo_id,0);
				}
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<236>");
			if((t_vbo)!=0){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<239>");
				if(t_surf->m_reset_vbo!=0){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<240>");
					p_UpdateVBO(t_surf);
				}else{
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<241>");
					if(t_surf->m_vbo_id.At(0)==0){
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<242>");
						t_surf->m_reset_vbo=-1;
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<243>");
						p_UpdateVBO(t_surf);
					}
				}
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<249>");
			if((t_mesh->m_anim)!=0){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<252>");
				t_anim_surf2=t_mesh->p_GetAnimSurface(t_surf);
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<254>");
				if(((t_vbo)!=0) && ((t_anim_surf2)!=0)){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<256>");
					t_mesh->p_UpdateVertexAnimFrame(t_anim_surf2,t_surf);
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<259>");
					if(t_anim_surf2->m_reset_vbo!=0){
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<260>");
						p_UpdateVBO(t_anim_surf2);
					}else{
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<261>");
						if(t_anim_surf2->m_vbo_id.At(0)==0){
							DBG_BLOCK();
							DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<262>");
							t_anim_surf2->m_reset_vbo=-1;
							DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<263>");
							p_UpdateVBO(t_anim_surf2);
						}
					}
				}
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<271>");
			m_effect->p_UpdateEffect(t_surf,t_ent,t_cam);
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<277>");
			if(m_effect->m_blend>-1 && m_effect->m_blend!=m_last_effect->m_blend){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<278>");
				glEnable(3042);
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<279>");
				int t_1=m_effect->m_blend;
				DBG_LOCAL(t_1,"1")
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<280>");
				if(t_1==0){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<282>");
					glBlendFunc(1,771);
				}else{
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<283>");
					if(t_1==1){
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<284>");
						glBlendFunc(770,771);
					}else{
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<285>");
						if(t_1==2){
							DBG_BLOCK();
							DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<286>");
							glBlendFunc(774,0);
						}else{
							DBG_BLOCK();
							DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<287>");
							if(t_1==3){
								DBG_BLOCK();
								DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<288>");
								glBlendFunc(770,1);
							}else{
								DBG_BLOCK();
								DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<289>");
								if(t_1==4){
									DBG_BLOCK();
									DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<290>");
									glBlendFunc(1,1);
								}
							}
						}
					}
				}
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<293>");
				if(m_effect->m_blend!=m_last_effect->m_blend){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<294>");
					glDisable(3042);
				}
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<299>");
			if(t_skip_sprite_state==false){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<304>");
				if(m_effect->m_use_flatshade!=m_last_effect->m_use_flatshade){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<305>");
					if(m_effect->m_use_flatshade==1){
						DBG_BLOCK();
						glShadeModel(7424);
					}else{
						DBG_BLOCK();
						glShadeModel(7425);
					}
				}
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<309>");
				if(m_effect->m_use_fog!=m_last_effect->m_use_fog){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<310>");
					if(m_effect->m_use_fog==1){
						DBG_BLOCK();
						glEnable(2912);
					}else{
						DBG_BLOCK();
						glDisable(2912);
					}
				}
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<315>");
				if(m_effect->m_use_backface_culling==0){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<316>");
					glDisable(2884);
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<317>");
					glLightModelf(2898,FLOAT(1.0));
				}else{
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<319>");
					glEnable(2884);
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<320>");
					glLightModelf(2898,FLOAT(0.0));
				}
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<325>");
				if(m_effect->m_use_depth_test!=m_last_effect->m_use_depth_test){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<326>");
					if(m_effect->m_use_depth_test==1){
						DBG_BLOCK();
						glEnable(2929);
					}else{
						DBG_BLOCK();
						glDisable(2929);
					}
				}
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<329>");
				if(m_effect->m_use_depth_write!=m_last_effect->m_use_depth_write){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<330>");
					if(m_effect->m_use_depth_write==0){
						DBG_BLOCK();
						glDepthMask(false);
					}else{
						DBG_BLOCK();
						glDepthMask(true);
					}
				}
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<334>");
				if(m_effect->m_use_alpha_test!=m_last_effect->m_use_alpha_test){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<335>");
					if(m_effect->m_use_alpha_test==1){
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<336>");
						glEnable(3008);
					}else{
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<338>");
						glDisable(3008);
					}
				}
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<354>");
			_glLightModelfv(2899,m_effect->m_ambient,0);
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<356>");
			if(m_effect->m_use_vertex_colors==1){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<359>");
				_glMaterialfv(1032,4610,m_effect->m_specular,0);
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<360>");
				_glMaterialfv(1032,5633,m_effect->m_shininess,0);
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<361>");
				_glMaterialfv(1032,4608,m_effect->m_ambient,0);
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<363>");
				glEnable(2903);
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<364>");
				glEnableClientState(32886);
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<368>");
				glDisableClientState(32886);
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<369>");
				glColor4f(m_effect->m_red,m_effect->m_green,m_effect->m_blue,m_effect->m_alpha);
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<371>");
				_glMaterialfv(1032,4608,m_effect->m_ambient,0);
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<372>");
				_glMaterialfv(1032,4610,m_effect->m_specular,0);
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<373>");
				_glMaterialfv(1032,5633,m_effect->m_shininess,0);
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<374>");
				glEnable(2903);
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<380>");
			if(m_effect->m_use_full_bright!=m_last_effect->m_use_full_bright){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<381>");
				if(m_effect->m_use_full_bright==1){
					DBG_BLOCK();
					glDisable(2896);
				}else{
					DBG_BLOCK();
					glEnable(2896);
				}
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<392>");
			if(t_skip_sprite_state==false){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<397>");
				if((t_vbo)!=0){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<400>");
					glBindBuffer(34962,t_surf->m_vbo_id.At(0));
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<401>");
					if(!(((t_mesh->m_anim_render)!=0) || t_surf->m_vbo_dyn)){
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<402>");
						glEnableClientState(32884);
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<403>");
						_glVertexPointer(3,5126,64,0);
					}
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<406>");
					_glNormalPointer(5126,64,16);
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<407>");
					_glColorPointer(4,5126,64,32);
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<408>");
					glBindBuffer(34963,t_surf->m_vbo_id.At(5));
				}else{
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<421>");
					glBindBuffer(34962,0);
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<422>");
					glBindBuffer(34963,0);
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<423>");
					glEnableClientState(32884);
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<425>");
					if(((t_mesh->m_anim_render)!=0) && ((t_anim_surf2)!=0)){
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<426>");
						_glVertexPointer(3,5126,64,t_anim_surf2->m_vert_data->m_buf);
					}else{
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<428>");
						gc_assign(m_slice_pos,t_surf->m_vert_data->p_BufferSlice(0));
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<429>");
						_glVertexPointer(3,5126,64,m_slice_pos);
					}
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<433>");
					gc_assign(m_slice_norm,t_surf->m_vert_data->p_BufferSlice(16));
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<434>");
					gc_assign(m_slice_color,t_surf->m_vert_data->p_BufferSlice(32));
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<435>");
					_glNormalPointer(5126,64,m_slice_norm);
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<436>");
					_glColorPointer(4,5126,64,m_slice_color);
				}
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<445>");
			if(((t_vbo)!=0) && (((t_mesh->m_anim_render)!=0) || t_surf->m_vbo_dyn || ((t_anim_surf2)!=0))){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<448>");
				if(((t_anim_surf2)!=0) && ((t_anim_surf2->m_vert_anim).Length()!=0)){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<449>");
					glEnableClientState(32884);
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<450>");
					glBindBuffer(34962,t_anim_surf2->m_vbo_id.At(4));
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<451>");
					_glVertexPointer(3,5126,0,0);
				}else{
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<454>");
					if(((t_mesh->m_anim_render)!=0) && ((t_anim_surf2)!=0)){
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<455>");
						glEnableClientState(32884);
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<456>");
						glBindBuffer(34962,t_anim_surf2->m_vbo_id.At(0));
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<457>");
						_glVertexPointer(3,5126,64,0);
					}else{
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<460>");
						if(t_surf->m_vbo_dyn){
							DBG_BLOCK();
							DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<461>");
							glEnableClientState(32884);
							DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<462>");
							glBindBuffer(34962,t_surf->m_vbo_id.At(0));
							DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<463>");
							_glVertexPointer(3,5126,64,0);
						}
					}
				}
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<467>");
				if(!((t_vbo)!=0) && (((t_mesh->m_anim_render)!=0) || t_surf->m_vbo_dyn || ((t_anim_surf2)!=0))){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<469>");
					glBindBuffer(34962,0);
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<470>");
					glBindBuffer(34963,0);
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<471>");
					glEnableClientState(32884);
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<474>");
					if(((t_anim_surf2)!=0) && ((t_anim_surf2->m_vert_anim).Length()!=0)){
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<476>");
						_glVertexPointer(3,5126,0,t_anim_surf2->m_vert_anim.At(t_anim_surf2->m_anim_frame)->m_buf);
					}else{
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<479>");
						if(((t_mesh->m_anim_render)!=0) && ((t_anim_surf2)!=0)){
							DBG_BLOCK();
							DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<481>");
							_glVertexPointer(3,5126,64,t_anim_surf2->m_vert_data->m_buf);
						}else{
							DBG_BLOCK();
							DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<484>");
							if(t_surf->m_vbo_dyn){
								DBG_BLOCK();
								DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<486>");
								_glVertexPointer(3,5126,64,t_surf->m_vert_data->m_buf);
							}
						}
					}
				}
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<497>");
			int t_tex_count=m_effect->m_num_tex;
			DBG_LOCAL(t_tex_count,"tex_count")
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<507>");
			if(t_tex_count<m_last_tex_count){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<509>");
				for(int t_ix=t_tex_count;t_ix<=m_last_tex_count-1;t_ix=t_ix+1){
					DBG_BLOCK();
					DBG_LOCAL(t_ix,"ix")
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<511>");
					if(t_ix>c_TRender::m_MAX_TEXTURES){
						DBG_BLOCK();
						break;
					}
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<513>");
					glActiveTexture(33984+t_ix);
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<514>");
					glClientActiveTexture(33984+t_ix);
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<516>");
					glDisable(3553);
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<517>");
					glDisableClientState(32888);
				}
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<532>");
			for(int t_ix2=0;t_ix2<=t_tex_count-1;t_ix2=t_ix2+1){
				DBG_BLOCK();
				DBG_LOCAL(t_ix2,"ix")
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<534>");
				if(t_surf->m_brush->m_tex.At(t_ix2)!=0 || t_ent->m_brush->m_tex.At(t_ix2)!=0){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<536>");
					c_TTexture* t_texture=0;
					int t_tex_flags=0;
					int t_tex_blend=0;
					int t_tex_coords=0;
					Float t_tex_u_scale=FLOAT(.0);
					Float t_tex_v_scale=FLOAT(.0);
					DBG_LOCAL(t_texture,"texture")
					DBG_LOCAL(t_tex_flags,"tex_flags")
					DBG_LOCAL(t_tex_blend,"tex_blend")
					DBG_LOCAL(t_tex_coords,"tex_coords")
					DBG_LOCAL(t_tex_u_scale,"tex_u_scale")
					DBG_LOCAL(t_tex_v_scale,"tex_v_scale")
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<537>");
					Float t_tex_u_pos=FLOAT(.0);
					Float t_tex_v_pos=FLOAT(.0);
					Float t_tex_ang=FLOAT(.0);
					int t_tex_cube_mode=0;
					int t_frame=0;
					int t_tex_smooth=0;
					DBG_LOCAL(t_tex_u_pos,"tex_u_pos")
					DBG_LOCAL(t_tex_v_pos,"tex_v_pos")
					DBG_LOCAL(t_tex_ang,"tex_ang")
					DBG_LOCAL(t_tex_cube_mode,"tex_cube_mode")
					DBG_LOCAL(t_frame,"frame")
					DBG_LOCAL(t_tex_smooth,"tex_smooth")
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<541>");
					if(t_ent->m_brush->m_tex.At(t_ix2)!=0){
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<542>");
						t_texture=t_ent->m_brush->m_tex.At(t_ix2);
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<543>");
						t_tex_flags=t_ent->m_brush->m_tex.At(t_ix2)->m_flags;
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<544>");
						t_tex_blend=t_ent->m_brush->m_tex.At(t_ix2)->m_blend;
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<545>");
						t_tex_coords=t_ent->m_brush->m_tex.At(t_ix2)->m_coords;
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<546>");
						t_tex_u_scale=t_ent->m_brush->m_tex.At(t_ix2)->m_u_scale;
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<547>");
						t_tex_v_scale=t_ent->m_brush->m_tex.At(t_ix2)->m_v_scale;
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<548>");
						t_tex_u_pos=t_ent->m_brush->m_tex.At(t_ix2)->m_u_pos;
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<549>");
						t_tex_v_pos=t_ent->m_brush->m_tex.At(t_ix2)->m_v_pos;
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<550>");
						t_tex_ang=t_ent->m_brush->m_tex.At(t_ix2)->m_angle;
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<551>");
						t_tex_cube_mode=t_ent->m_brush->m_tex.At(t_ix2)->m_cube_mode;
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<552>");
						t_frame=t_ent->m_brush->m_tex.At(t_ix2)->m_tex_frame;
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<553>");
						t_tex_smooth=((t_ent->m_brush->m_tex.At(t_ix2)->m_tex_smooth)?1:0);
					}else{
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<556>");
						t_texture=t_surf->m_brush->m_tex.At(t_ix2);
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<557>");
						t_tex_flags=t_surf->m_brush->m_tex.At(t_ix2)->m_flags;
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<558>");
						t_tex_blend=t_surf->m_brush->m_tex.At(t_ix2)->m_blend;
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<559>");
						t_tex_coords=t_surf->m_brush->m_tex.At(t_ix2)->m_coords;
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<560>");
						t_tex_u_scale=t_surf->m_brush->m_tex.At(t_ix2)->m_u_scale;
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<561>");
						t_tex_v_scale=t_surf->m_brush->m_tex.At(t_ix2)->m_v_scale;
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<562>");
						t_tex_u_pos=t_surf->m_brush->m_tex.At(t_ix2)->m_u_pos;
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<563>");
						t_tex_v_pos=t_surf->m_brush->m_tex.At(t_ix2)->m_v_pos;
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<564>");
						t_tex_ang=t_surf->m_brush->m_tex.At(t_ix2)->m_angle;
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<565>");
						t_tex_cube_mode=t_surf->m_brush->m_tex.At(t_ix2)->m_cube_mode;
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<566>");
						t_frame=t_surf->m_brush->m_tex.At(t_ix2)->m_tex_frame;
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<567>");
						t_tex_smooth=((t_surf->m_brush->m_tex.At(t_ix2)->m_tex_smooth)?1:0);
					}
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<574>");
					if((((t_surf->m_brush->m_tex.At(t_ix2))!=0) && m_last_texture==t_surf->m_brush->m_tex.At(t_ix2) || ((t_ent->m_brush->m_tex.At(t_ix2))!=0) && m_last_texture==t_ent->m_brush->m_tex.At(t_ix2)) && t_ix2==0){
						DBG_BLOCK();
					}else{
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<582>");
						if((t_surf->m_brush->m_tex.At(t_ix2))!=0){
							DBG_BLOCK();
							gc_assign(m_last_texture,t_surf->m_brush->m_tex.At(t_ix2));
						}else{
							DBG_BLOCK();
							gc_assign(m_last_texture,t_ent->m_brush->m_tex.At(t_ix2));
						}
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<584>");
						glActiveTexture(33984+t_ix2);
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<585>");
						glClientActiveTexture(33984+t_ix2);
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<588>");
						glBindTexture(3553,t_texture->m_gltex.At(0));
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<589>");
						glEnable(3553);
					}
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<598>");
					if(!t_skip_sprite_state){
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<602>");
						if((t_tex_flags&4)!=0){
							DBG_BLOCK();
						}
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<608>");
						if((t_tex_flags&8)!=0){
							DBG_BLOCK();
							DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<609>");
							if((t_tex_smooth)!=0){
								DBG_BLOCK();
								DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<610>");
								glTexParameteri(3553,10240,9729);
								DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<611>");
								glTexParameteri(3553,10241,9986);
							}else{
								DBG_BLOCK();
								DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<613>");
								glTexParameteri(3553,10240,9728);
								DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<614>");
								glTexParameteri(3553,10241,9984);
							}
						}else{
							DBG_BLOCK();
							DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<617>");
							if((t_tex_smooth)!=0){
								DBG_BLOCK();
								DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<618>");
								glTexParameteri(3553,10240,9729);
								DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<619>");
								glTexParameteri(3553,10241,9729);
							}else{
								DBG_BLOCK();
								DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<621>");
								glTexParameteri(3553,10240,9728);
								DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<622>");
								glTexParameteri(3553,10241,9728);
							}
						}
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<627>");
						if((t_tex_flags&16)!=0){
							DBG_BLOCK();
							DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<628>");
							glTexParameteri(3553,10242,33071);
						}else{
							DBG_BLOCK();
							DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<630>");
							glTexParameteri(3553,10242,10497);
						}
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<634>");
						if((t_tex_flags&32)!=0){
							DBG_BLOCK();
							DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<635>");
							glTexParameteri(3553,10243,33071);
						}else{
							DBG_BLOCK();
							DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<637>");
							glTexParameteri(3553,10243,10497);
						}
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<689>");
						int t_2=t_tex_blend;
						DBG_LOCAL(t_2,"2")
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<690>");
						if(t_2==0){
							DBG_BLOCK();
							DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<691>");
							glTexEnvf(8960,8704,FLOAT(7681.0));
						}else{
							DBG_BLOCK();
							DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<692>");
							if(t_2==1){
								DBG_BLOCK();
								DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<693>");
								glTexEnvf(8960,8704,FLOAT(8449.0));
							}else{
								DBG_BLOCK();
								DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<694>");
								if(t_2==2){
									DBG_BLOCK();
									DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<695>");
									glTexEnvf(8960,8704,FLOAT(8448.0));
								}else{
									DBG_BLOCK();
									DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<696>");
									if(t_2==3){
										DBG_BLOCK();
										DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<697>");
										glTexEnvf(8960,8704,FLOAT(260.0));
									}else{
										DBG_BLOCK();
										DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<698>");
										if(t_2==4){
											DBG_BLOCK();
											DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<699>");
											glTexEnvf(8960,8704,FLOAT(34160.0));
											DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<700>");
											glTexEnvf(8960,34161,FLOAT(34478.0));
										}else{
											DBG_BLOCK();
											DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<701>");
											if(t_2==5){
												DBG_BLOCK();
												DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<702>");
												glTexEnvi(8960,8704,34160);
												DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<703>");
												glTexEnvi(8960,34161,8448);
												DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<704>");
												glTexEnvi(8960,34163,2);
											}else{
												DBG_BLOCK();
												DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<705>");
												if(t_2==6){
													DBG_BLOCK();
													DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<706>");
													glTexEnvf(8960,8704,FLOAT(3042.0));
												}else{
													DBG_BLOCK();
													DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<708>");
													glTexEnvf(8960,8704,FLOAT(8448.0));
												}
											}
										}
									}
								}
							}
						}
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<713>");
						glEnableClientState(32888);
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<715>");
						if((t_vbo)!=0){
							DBG_BLOCK();
							DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<716>");
							if(t_tex_coords==0){
								DBG_BLOCK();
								DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<717>");
								glBindBuffer(34962,t_surf->m_vbo_id.At(0));
								DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<718>");
								_glTexCoordPointer(2,5126,64,48);
							}else{
								DBG_BLOCK();
								DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<720>");
								glBindBuffer(34962,t_surf->m_vbo_id.At(0));
								DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<721>");
								_glTexCoordPointer(2,5126,64,56);
							}
						}else{
							DBG_BLOCK();
							DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<725>");
							if(t_tex_coords==0){
								DBG_BLOCK();
								DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<727>");
								_glTexCoordPointer(2,5126,64,t_surf->m_vert_data->p_BufferSlice(48));
							}else{
								DBG_BLOCK();
								DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<730>");
								_glTexCoordPointer(2,5126,64,t_surf->m_vert_data->p_BufferSlice(56));
							}
						}
					}
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<764>");
					glMatrixMode(5890);
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<765>");
					glLoadIdentity();
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<767>");
					if(t_tex_u_pos!=FLOAT(0.0) || t_tex_v_pos!=FLOAT(0.0)){
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<768>");
						glTranslatef(t_tex_u_pos,t_tex_v_pos,FLOAT(0.0));
					}
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<770>");
					if(t_tex_ang!=FLOAT(0.0)){
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<771>");
						glRotatef(t_tex_ang,FLOAT(0.0),FLOAT(0.0),FLOAT(1.0));
					}
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<773>");
					if(t_tex_u_scale!=FLOAT(1.0) || t_tex_v_scale!=FLOAT(1.0)){
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<774>");
						glScalef(t_tex_u_scale,t_tex_v_scale,FLOAT(1.0));
					}
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<785>");
					if((t_tex_flags&128)!=0){
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<787>");
						glScalef(FLOAT(1.0),FLOAT(-1.0),FLOAT(-1.0));
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<790>");
						Array<Float > t_mod_mat=Array<Float >(16);
						DBG_LOCAL(t_mod_mat,"mod_mat")
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<791>");
						_glGetFloatv(2982,t_mod_mat,0);
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<794>");
						c_Matrix* t_new_mat=(new c_Matrix)->m_new();
						DBG_LOCAL(t_new_mat,"new_mat")
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<795>");
						t_new_mat->p_LoadIdentity();
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<797>");
						t_new_mat->m_grid.At(0).At(0)=t_mod_mat.At(0);
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<798>");
						t_new_mat->m_grid.At(1).At(0)=t_mod_mat.At(1);
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<799>");
						t_new_mat->m_grid.At(2).At(0)=t_mod_mat.At(2);
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<801>");
						t_new_mat->m_grid.At(0).At(1)=t_mod_mat.At(4);
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<802>");
						t_new_mat->m_grid.At(1).At(1)=t_mod_mat.At(5);
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<803>");
						t_new_mat->m_grid.At(2).At(1)=t_mod_mat.At(6);
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<805>");
						t_new_mat->m_grid.At(0).At(2)=t_mod_mat.At(8);
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<806>");
						t_new_mat->m_grid.At(1).At(2)=t_mod_mat.At(9);
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<807>");
						t_new_mat->m_grid.At(2).At(2)=t_mod_mat.At(10);
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<809>");
						_glMultMatrixf(t_new_mat->p_ToArray(),0);
					}
				}
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<820>");
			if(t_tex_count==0){
				DBG_BLOCK();
				glDisable(3553);
				m_last_texture=0;
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<821>");
			m_last_tex_count=t_tex_count;
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<826>");
			glMatrixMode(5888);
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<828>");
			glPushMatrix();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<830>");
			if(t_mesh->m_is_sprite==false){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<831>");
				t_ent->m_mat->p_ToArray2(m_t_array);
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<832>");
				_glMultMatrixf(m_t_array,0);
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<834>");
				dynamic_cast<c_TSprite*>(t_mesh)->m_mat_sp->p_ToArray2(m_t_array);
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<835>");
				_glMultMatrixf(m_t_array,0);
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<838>");
			if((c_TRender::m_wireframe)!=0){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<840>");
				if(!((t_vbo)!=0)){
					DBG_BLOCK();
					_glDrawElements(2,t_surf->m_no_tris*3,5123,t_surf->m_tris->m_buf);
				}
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<841>");
				if((t_vbo)!=0){
					DBG_BLOCK();
					_glDrawElements(2,t_surf->m_no_tris*3,5123,0);
				}
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<844>");
				if((t_vbo)!=0){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<846>");
					_glDrawElements(4,t_surf->m_no_tris*3,5123,0);
				}else{
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<850>");
					_glDrawElements(4,t_surf->m_no_tris*3,5123,t_surf->m_tris->m_buf);
				}
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<855>");
			glPopMatrix();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<858>");
			m_last_effect->p_Overwrite2(m_effect);
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<863>");
		if(!((m_alpha_list)!=0)){
			DBG_BLOCK();
			break;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<864>");
		t_temp_list=(m_alpha_list);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<868>");
	t_temp_list=0;
}
void c_OpenglES11::p_Finish(){
	DBG_ENTER("OpenglES11.Finish")
	c_OpenglES11 *self=this;
	DBG_LOCAL(self,"Self")
}
bool c_OpenglES11::m_opengl_es;
Float c_OpenglES11::p_GetVersion(){
	DBG_ENTER("OpenglES11.GetVersion")
	c_OpenglES11 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<122>");
	String t_st=String();
	DBG_LOCAL(t_st,"st")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<124>");
	String t_s=_glGetString(7938);
	DBG_LOCAL(t_s,"s")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<126>");
	m_opengl_es=t_s.Contains(String(L"ES",2));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<128>");
	int t_num=0;
	DBG_LOCAL(t_num,"num")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<130>");
	for(int t_i=0;t_i<=t_s.Length()-1;t_i=t_i+1){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<132>");
		if((int)t_s.At(t_i)>47 && (int)t_s.At(t_i)<58){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<133>");
			t_st=t_st+String((Char)((int)t_s.At(t_i)),1);
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<134>");
			if(t_num==0){
				DBG_BLOCK();
				t_num=1;
			}
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<135>");
			if((int)t_s.At(t_i)==46){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<136>");
				if(t_num==2){
					DBG_BLOCK();
					break;
				}
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<137>");
				t_st=t_st+String((Char)((int)t_s.At(t_i)),1);
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<138>");
				t_num=2;
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<139>");
				if(t_num!=0){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<140>");
					break;
				}
			}
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<144>");
	Float t_=Float(int((t_st).ToFloat()*FLOAT(10.0)))/FLOAT(10.0);
	return t_;
}
void c_OpenglES11::p_EnableStates(){
	DBG_ENTER("OpenglES11.EnableStates")
	c_OpenglES11 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<958>");
	glEnable(2896);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<959>");
	glEnable(2929);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<960>");
	glEnable(2912);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<961>");
	glEnable(2884);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<962>");
	glEnable(3089);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<963>");
	glDisable(3008);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<964>");
	glDisable(2960);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<966>");
	glEnable(32826);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<970>");
	glEnableClientState(32884);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<971>");
	glEnableClientState(32886);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<972>");
	glEnableClientState(32885);
}
int c_OpenglES11::p_EnableHardwareInfo(){
	DBG_ENTER("OpenglES11.EnableHardwareInfo")
	c_OpenglES11 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<938>");
	Array<int > t_data=Array<int >(2);
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<939>");
	_glGetIntegerv(34018,t_data,0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<940>");
	c_TRender::m_MAX_TEXTURES=t_data.At(0)-1;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<941>");
	if(true){
		DBG_BLOCK();
		bbPrint(String(L"..max textures:",15)+String(c_TRender::m_MAX_TEXTURES)+String(L"1",1));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<945>");
	String t_ext=_glGetString(7939).ToLower();
	DBG_LOCAL(t_ext,"ext")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<947>");
	if(!t_ext.Contains(String(L"vertex_buffer_object",20)) && !m_opengl_es){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<948>");
		c_TRender::m_vbo_enabled=false;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<949>");
		if(true){
			DBG_BLOCK();
			bbPrint(String(L"..VBO Disabled",14));
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<953>");
	return 1;
}
int c_OpenglES11::p_GraphicsInit(int t_flags){
	DBG_ENTER("OpenglES11.GraphicsInit")
	c_OpenglES11 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_flags,"flags")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<884>");
	gc_assign(c_TRender::m_render,((new c_OpenglES11)->m_new()));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<886>");
	String t_s=String(p_GetVersion());
	DBG_LOCAL(t_s,"s")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<887>");
	if(m_opengl_es){
		DBG_BLOCK();
		t_s=t_s+String(L" ES",3);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<890>");
	bbPrint(String(L"..OPENGL VERSION: ",18)+t_s);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<893>");
	c_TTexture::m_TextureFilter(String(),9);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<899>");
	c_TRender::m_width=bb_app2_DeviceWidth();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<900>");
	c_TRender::m_height=bb_app2_DeviceHeight();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<903>");
	c_TPixmapGL::m_Init();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<907>");
	if(!((t_flags&2)==1)){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<908>");
		c_TRender::m_vbo_enabled=true;
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<910>");
		c_TRender::m_vbo_enabled=false;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<911>");
		if(true){
			DBG_BLOCK();
			bbPrint(String(L"..VBO Disabled (forced)",23));
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<914>");
	p_EnableStates();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<918>");
	_glClearDepthf(FLOAT(1.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<919>");
	glDepthFunc(515);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<920>");
	glHint(3152,4354);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<922>");
	glAlphaFunc(518,FLOAT(0.5));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<924>");
	c_TEntity::m_global_mat->p_LoadIdentity();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<926>");
	p_EnableHardwareInfo();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<928>");
	if(glGetError()!=0){
		DBG_BLOCK();
		bbPrint(String(L"Error: GL INIT",14));
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<930>");
	return 1;
}
int c_OpenglES11::p_DeleteTexture(c_TTexture* t_tex){
	DBG_ENTER("OpenglES11.DeleteTexture")
	c_OpenglES11 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_tex,"tex")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1125>");
	if((t_tex->m_gltex.At(0))!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1126>");
		if((t_tex->m_gltex.At(0))!=0){
			DBG_BLOCK();
			_glDeleteTextures(1,t_tex->m_gltex,0);
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1127>");
		t_tex->m_gltex.At(0)=0;
	}
	return 0;
}
c_TTexture* c_OpenglES11::p_BindTexture(c_TTexture* t_tex,int t_flags){
	DBG_ENTER("OpenglES11.BindTexture")
	c_OpenglES11 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_tex,"tex")
	DBG_LOCAL(t_flags,"flags")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1144>");
	c_TRender::m_render->p_ClearErrors();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1150>");
	if((t_flags&4)!=0){
		DBG_BLOCK();
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1157>");
	int t_width=t_tex->m_pixmap->m_width;
	DBG_LOCAL(t_width,"width")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1158>");
	int t_height=t_tex->m_pixmap->m_height;
	DBG_LOCAL(t_height,"height")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1160>");
	if(t_width==0 || t_height==0){
		DBG_BLOCK();
		return t_tex;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1162>");
	if(!((t_tex->m_gltex.At(0))!=0)){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1163>");
		_glGenTextures(1,t_tex->m_gltex,0);
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1164>");
		if((t_tex->m_pixmap->m_bind)!=0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1166>");
			return t_tex;
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1169>");
	glBindTexture(3553,t_tex->m_gltex.At(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1171>");
	glTexParameteri(3553,10242,10497);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1172>");
	glTexParameteri(3553,10243,10497);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1173>");
	if((t_flags&8)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1174>");
		glTexParameteri(3553,10240,9728);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1175>");
		glTexParameteri(3553,10241,9985);
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1177>");
		glTexParameteri(3553,10240,9728);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1178>");
		glTexParameteri(3553,10241,9728);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1181>");
	int t_mipmap=0;
	int t_mip_level=0;
	DBG_LOCAL(t_mipmap,"mipmap")
	DBG_LOCAL(t_mip_level,"mip_level")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1182>");
	c_TPixmapGL* t_pix=dynamic_cast<c_TPixmapGL*>(t_tex->m_pixmap);
	DBG_LOCAL(t_pix,"pix")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1186>");
	if((t_flags&8)!=0){
		DBG_BLOCK();
		t_mipmap=1;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1188>");
	do{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1189>");
		glPixelStorei(3317,1);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1190>");
		_glTexImage2D(3553,t_mip_level,6408,t_width,t_height,0,6408,5121,t_pix->m_pixels);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1192>");
		if(glGetError()!=0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1193>");
			bbError(String(L"** out of texture memory **",27));
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1196>");
		if(!((t_mipmap)!=0) || t_width==1 && t_height==1){
			DBG_BLOCK();
			break;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1197>");
		if(t_width>1){
			DBG_BLOCK();
			t_width=int(Float(t_width)*FLOAT(0.5));
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1198>");
		if(t_height>1){
			DBG_BLOCK();
			t_height=int(Float(t_height)*FLOAT(0.5));
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1204>");
		if(t_tex->m_resize_smooth){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1205>");
			t_pix=dynamic_cast<c_TPixmapGL*>(t_pix->p_ResizePixmap(t_width,t_height));
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1207>");
			t_pix=dynamic_cast<c_TPixmapGL*>(t_pix->p_ResizePixmapNoSmooth(t_width,t_height));
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1211>");
		t_mip_level+=1;
	}while(!(false));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1215>");
	t_tex->m_no_mipmaps=t_mip_level;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1216>");
	t_tex->m_pixmap->p_SetBind();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1218>");
	return t_tex;
}
Array<int > c_OpenglES11::m_gl_light;
int c_OpenglES11::p_DisableLight(c_TLight* t_light){
	DBG_ENTER("OpenglES11.DisableLight")
	c_OpenglES11 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_light,"light")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1302>");
	t_light->m_light_link->p_Remove();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1304>");
	glDisable(m_gl_light.At(c_TLight::m_no_lights));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1306>");
	t_light=0;
	return 0;
}
int c_OpenglES11::m_light_no;
int c_OpenglES11::m_old_no_lights;
int c_OpenglES11::p_UpdateLight(c_TCamera* t_cam,c_TLight* t_light){
	DBG_ENTER("OpenglES11.UpdateLight")
	c_OpenglES11 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_cam,"cam")
	DBG_LOCAL(t_light,"light")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1225>");
	if(t_light->m_remove_light){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1226>");
		p_DisableLight(t_light);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1227>");
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1230>");
	m_light_no=m_light_no+1;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1231>");
	if(m_light_no>c_TLight::m_no_lights){
		DBG_BLOCK();
		m_light_no=1;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1233>");
	if(t_light->p_Hidden()==true){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1234>");
		glDisable(m_gl_light.At(m_light_no-1));
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1235>");
		return 0;
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1237>");
		glEnable(m_gl_light.At(m_light_no-1));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1241>");
	if(m_old_no_lights<m_light_no){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1243>");
		Float t_[]={t_light->m_spec_red,t_light->m_spec_grn,t_light->m_spec_blu,t_light->m_spec_a};
		_glLightfv(m_gl_light.At(m_light_no-1),4610,Array<Float >(t_,4),0);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1247>");
		Float t_2[]={t_light->m_const_att};
		_glLightfv(m_gl_light.At(m_light_no-1),4615,Array<Float >(t_2,1),0);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1251>");
		if(t_light->m_light_type==3){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1253>");
			Float t_3[]={t_light->m_spot_exp};
			_glLightfv(m_gl_light.At(m_light_no-1),4613,Array<Float >(t_3,1),0);
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1258>");
	m_old_no_lights=m_light_no;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1260>");
	glMatrixMode(5888);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1261>");
	glPushMatrix();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1263>");
	_glMultMatrixf(t_light->m_mat->p_ToArray(),0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1265>");
	Float t_z=FLOAT(1.0);
	DBG_LOCAL(t_z,"z")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1266>");
	Float t_w=FLOAT(0.0);
	DBG_LOCAL(t_w,"w")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1267>");
	if(t_light->m_light_type>1){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1268>");
		t_z=FLOAT(0.0);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1269>");
		t_w=FLOAT(1.0);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1272>");
	Float t_4[]={t_light->m_red,t_light->m_green,t_light->m_blue,FLOAT(1.0)};
	Array<Float > t_rgba=Array<Float >(t_4,4);
	DBG_LOCAL(t_rgba,"rgba")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1273>");
	Float t_5[]={FLOAT(0.0),FLOAT(0.0),t_z,t_w};
	Array<Float > t_pos=Array<Float >(t_5,4);
	DBG_LOCAL(t_pos,"pos")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1275>");
	_glLightfv(m_gl_light.At(m_light_no-1),4611,t_pos,0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1276>");
	_glLightfv(m_gl_light.At(m_light_no-1),4609,t_rgba,0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1279>");
	Float t_6[]={t_light->m_lin_att};
	_glLightfv(m_gl_light.At(m_light_no-1),4616,Array<Float >(t_6,1),0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1283>");
	if(t_light->m_light_type==3){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1285>");
		Float t_7[]={FLOAT(0.0),FLOAT(0.0),FLOAT(-1.0)};
		Array<Float > t_dir=Array<Float >(t_7,3);
		DBG_LOCAL(t_dir,"dir")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1286>");
		Float t_8[]={t_light->m_outer_ang};
		Array<Float > t_outer=Array<Float >(t_8,1);
		DBG_LOCAL(t_outer,"outer")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1288>");
		_glLightfv(m_gl_light.At(m_light_no-1),4612,t_dir,0);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1289>");
		_glLightfv(m_gl_light.At(m_light_no-1),4614,t_outer,0);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1293>");
	glPopMatrix();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1295>");
	if(true && ((glGetError())!=0)){
		DBG_BLOCK();
		bbPrint(String(L"**error: glLights",17));
	}
	return 0;
}
int c_OpenglES11::p_UpdateCamera(c_TCamera* t_cam){
	DBG_ENTER("OpenglES11.UpdateCamera")
	c_OpenglES11 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_cam,"cam")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1315>");
	if((t_cam->m_draw2D)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1316>");
		glViewport(0,0,bb_app2_DeviceWidth(),bb_app2_DeviceHeight());
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1318>");
		glViewport(t_cam->m_vx,t_cam->m_vy,t_cam->m_vwidth,t_cam->m_vheight);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1322>");
	glEnable(3089);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1325>");
	glScissor(t_cam->m_viewport.At(0),t_cam->m_viewport.At(1),t_cam->m_viewport.At(2),t_cam->m_viewport.At(3));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1326>");
	glClearColor(t_cam->m_cls_r,t_cam->m_cls_g,t_cam->m_cls_b,FLOAT(1.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1329>");
	glMatrixMode(5888);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1331>");
	t_cam->m_mod_mat->p_ToArray2(m_t_array);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1332>");
	_glLoadMatrixf(m_t_array,0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1334>");
	glMatrixMode(5889);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1336>");
	t_cam->m_proj_mat->p_ToArray2(m_t_array);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1337>");
	_glLoadMatrixf(m_t_array,0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1342>");
	if(t_cam->m_cls_color==true && t_cam->m_cls_zbuffer==true){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1343>");
		glDepthMask(true);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1344>");
		glClear(16640);
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1346>");
		if(t_cam->m_cls_color==true){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1347>");
			glClear(16384);
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1349>");
			if(t_cam->m_cls_zbuffer==true){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1350>");
				glDepthMask(true);
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1351>");
				glClear(256);
			}
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1358>");
	if(t_cam->m_fog_mode>0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1359>");
		glEnable(2912);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1360>");
		glFogf(2917,FLOAT(9729.0));
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1361>");
		glFogf(2915,t_cam->m_fog_range_near);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1362>");
		glFogf(2916,t_cam->m_fog_range_far);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1364>");
		Float t_[]={t_cam->m_fog_r,t_cam->m_fog_g,t_cam->m_fog_b,FLOAT(1.0)};
		_glFogfv(2918,Array<Float >(t_,4),0);
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1366>");
		glDisable(2912);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<1369>");
	if(true && ((m_GetGLError())!=0)){
		DBG_BLOCK();
		bbPrint(String(L"**error: glCamera",17));
	}
	return 0;
}
int c_OpenglES11::p_ClearErrors(){
	DBG_ENTER("OpenglES11.ClearErrors")
	c_OpenglES11 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<994>");
	if(true){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<995>");
		while(glGetError()!=0){
			DBG_BLOCK();
		}
	}
	return 0;
}
void c_OpenglES11::mark(){
	c_TRender::mark();
	gc_mark_q(m_last_effect);
	gc_mark_q(m_effect);
	gc_mark_q(m_slice_pos);
	gc_mark_q(m_slice_norm);
	gc_mark_q(m_slice_color);
	gc_mark_q(m_t_array);
}
String c_OpenglES11::debug(){
	String t="(OpenglES11)\n";
	t=c_TRender::debug()+t;
	t+=dbg_decl("alpha_list",&c_OpenglES11::m_alpha_list);
	t+=dbg_decl("last_texture",&c_OpenglES11::m_last_texture);
	t+=dbg_decl("last_sprite",&c_OpenglES11::m_last_sprite);
	t+=dbg_decl("last_tex_count",&c_OpenglES11::m_last_tex_count);
	t+=dbg_decl("gl_light",&c_OpenglES11::m_gl_light);
	t+=dbg_decl("light_no",&c_OpenglES11::m_light_no);
	t+=dbg_decl("old_no_lights",&c_OpenglES11::m_old_no_lights);
	t+=dbg_decl("_useMojo",&c_OpenglES11::m__useMojo);
	t+=dbg_decl("t_array",&m_t_array);
	t+=dbg_decl("effect",&m_effect);
	t+=dbg_decl("last_effect",&m_last_effect);
	t+=dbg_decl("slice_pos",&m_slice_pos);
	t+=dbg_decl("slice_norm",&m_slice_norm);
	t+=dbg_decl("slice_color",&m_slice_color);
	t+=dbg_decl("opengl_es",&c_OpenglES11::m_opengl_es);
	t+=dbg_decl("count1280error",&c_OpenglES11::m_count1280error);
	return t;
}
c_MojoEmulationDevice::c_MojoEmulationDevice(){
	m_mesh=0;
	m_layer=0;
	m_solid=Array<c_TSurface* >(512);
	m_lastBlend=-1;
	m_lastSurface=0;
	m_mat=(new c_Matrix)->m_new();
	m_fontImage=0;
	m_fontFile=String(L"mojo_font.png",13);
	m_colora=FLOAT(1.0);
	m_colorr=0;
	m_colorg=0;
	m_colorb=0;
	m_zdepth=FLOAT(1.99999);
}
c_MojoEmulationDevice* c_MojoEmulationDevice::m__device;
gxtkGraphics* c_MojoEmulationDevice::m__olddevice;
c_MojoEmulationDevice* c_MojoEmulationDevice::m_new(){
	DBG_ENTER("MojoEmulationDevice.new")
	c_MojoEmulationDevice *self=this;
	DBG_LOCAL(self,"Self")
	return this;
}
c_QuadCache* c_MojoEmulationDevice::m__quadCache;
void c_MojoEmulationDevice::p_NewLayer(){
	DBG_ENTER("MojoEmulationDevice.NewLayer")
	c_MojoEmulationDevice *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<129>");
	if(m_mesh==0){
		DBG_BLOCK();
		return;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<131>");
	m_layer+=1;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<132>");
	if(m_layer>512){
		DBG_BLOCK();
		m_layer=0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<133>");
	if(!((m_solid.At(m_layer))!=0)){
		DBG_BLOCK();
		gc_assign(m_solid.At(m_layer),m_mesh->p_CreateSurface(0));
	}else{
		DBG_BLOCK();
		m_mesh->p_AddSurface(m_solid.At(m_layer));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<136>");
	m_solid.At(m_layer)->m_no_verts=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<137>");
	m_solid.At(m_layer)->m_no_tris=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<138>");
	m_solid.At(m_layer)->m_vbo_dyn=true;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<139>");
	m_solid.At(m_layer)->m_brush->m_fx=35;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<140>");
	m_mesh->m_brush->m_blend=0;
}
int c_MojoEmulationDevice::p_Reset(){
	DBG_ENTER("MojoEmulationDevice.Reset")
	c_MojoEmulationDevice *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<146>");
	if(!((m_mesh)!=0)){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<147>");
		gc_assign(m_mesh,bb_functions_CreateMesh(0));
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<148>");
		m_mesh->m_entity_link->p_Remove();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<149>");
		m_mesh->p_EntityFX(67);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<151>");
		m_layer=-1;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<152>");
		p_NewLayer();
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<162>");
	m_mesh->m_no_surfs=1;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<163>");
	m_mesh->m_surf_list->p_Clear();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<164>");
	m_mesh->m_surf_list->p_AddLast2(m_solid.At(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<166>");
	m_solid.At(0)->m_no_verts=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<167>");
	m_solid.At(0)->m_no_tris=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<169>");
	m_layer=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<170>");
	m_lastBlend=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<171>");
	m_lastSurface=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<173>");
	c_TRender::m_draw_list->p_AddLast3(m_mesh);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<175>");
	m_mat->p_LoadIdentity();
	return 0;
}
bool c_MojoEmulationDevice::m_firstTimeRun;
void c_MojoEmulationDevice::p_InitFont(){
	DBG_ENTER("MojoEmulationDevice.InitFont")
	c_MojoEmulationDevice *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<102>");
	if(((m_fontImage)!=0) && m_fontImage->p_Width()>0){
		DBG_BLOCK();
		return;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<106>");
	gc_assign(m_fontImage,bb_graphics_LoadImage(m_fontFile,96,2));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<108>");
	if(((m_fontImage)!=0) && m_fontImage->p_Width()>0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<109>");
		bb_graphics_SetFont(m_fontImage,32);
	}
}
void c_MojoEmulationDevice::m_SetDevice(){
	DBG_ENTER("MojoEmulationDevice.SetDevice")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<73>");
	if(!((m__device)!=0)){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<75>");
		gc_assign(m__olddevice,bb_graphics_GetGraphicsDevice());
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<76>");
		gc_assign(m__device,(new c_MojoEmulationDevice)->m_new());
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<77>");
		gc_assign(m__quadCache,(new c_QuadCache)->m_new());
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<86>");
	m__device->p_Reset();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<87>");
	bb_graphics_SetGraphicsDevice(m__device);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<88>");
	bb_graphics_BeginRender();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<91>");
	if(m_firstTimeRun){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<92>");
		m__device->p_InitFont();
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<94>");
		bb_functions_PreLoadPixmap2(m__device->m_fontFile);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<96>");
	m_firstTimeRun=true;
}
int c_MojoEmulationDevice::Width(){
	DBG_ENTER("MojoEmulationDevice.Width")
	c_MojoEmulationDevice *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<191>");
	return c_TRender::m_width;
}
int c_MojoEmulationDevice::Height(){
	DBG_ENTER("MojoEmulationDevice.Height")
	c_MojoEmulationDevice *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<195>");
	return c_TRender::m_height;
}
gxtkSurface* c_MojoEmulationDevice::LoadSurface(String t_path){
	DBG_ENTER("MojoEmulationDevice.LoadSurface")
	c_MojoEmulationDevice *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_path,"path")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<200>");
	c_MojoSurface* t_msurf=c_MojoSurface::m_PreLoad(t_path,m_mesh,m__device);
	DBG_LOCAL(t_msurf,"msurf")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<202>");
	gxtkSurface* t_=(t_msurf);
	return t_;
}
gxtkSurface* c_MojoEmulationDevice::CreateSurface(int t_width,int t_height){
	DBG_ENTER("MojoEmulationDevice.CreateSurface")
	c_MojoEmulationDevice *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_width,"width")
	DBG_LOCAL(t_height,"height")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<206>");
	c_MojoSurface* t_msurf=c_MojoSurface::m_Create(String());
	DBG_LOCAL(t_msurf,"msurf")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<208>");
	gxtkSurface* t_=(t_msurf);
	return t_;
}
int c_MojoEmulationDevice::WritePixels2(gxtkSurface* t_surface,Array<int > t_pixels,int t_x,int t_y,int t_width,int t_height,int t_offset,int t_pitch){
	DBG_ENTER("MojoEmulationDevice.WritePixels2")
	c_MojoEmulationDevice *self=this;
	DBG_LOCAL(self,"Self")
	return 0;
}
int c_MojoEmulationDevice::Cls(Float t_r,Float t_g,Float t_b){
	DBG_ENTER("MojoEmulationDevice.Cls")
	c_MojoEmulationDevice *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_r,"r")
	DBG_LOCAL(t_g,"g")
	DBG_LOCAL(t_b,"b")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<239>");
	c_TRender::m_camera2D->p_CameraClsColor(t_r,t_g,t_b);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<240>");
	c_TRender::m_camera2D->p_CameraClsMode(true,false);
	return 0;
}
int c_MojoEmulationDevice::SetAlpha(Float t_alpha){
	DBG_ENTER("MojoEmulationDevice.SetAlpha")
	c_MojoEmulationDevice *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_alpha,"alpha")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<244>");
	m_colora=t_alpha;
	return 0;
}
int c_MojoEmulationDevice::SetColor(Float t_r,Float t_g,Float t_b){
	DBG_ENTER("MojoEmulationDevice.SetColor")
	c_MojoEmulationDevice *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_r,"r")
	DBG_LOCAL(t_g,"g")
	DBG_LOCAL(t_b,"b")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<248>");
	m_colorr=int(t_r);
	m_colorg=int(t_g);
	m_colorb=int(t_b);
	return 0;
}
int c_MojoEmulationDevice::SetMatrix(Float t_ix,Float t_iy,Float t_jx,Float t_jy,Float t_tx,Float t_ty){
	DBG_ENTER("MojoEmulationDevice.SetMatrix")
	c_MojoEmulationDevice *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_ix,"ix")
	DBG_LOCAL(t_iy,"iy")
	DBG_LOCAL(t_jx,"jx")
	DBG_LOCAL(t_jy,"jy")
	DBG_LOCAL(t_tx,"tx")
	DBG_LOCAL(t_ty,"ty")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<252>");
	m_mat->m_grid.At(0).At(0)=t_ix;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<253>");
	m_mat->m_grid.At(1).At(0)=t_iy;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<254>");
	m_mat->m_grid.At(0).At(1)=t_jx;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<255>");
	m_mat->m_grid.At(1).At(1)=t_jy;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<256>");
	m_mat->m_grid.At(3).At(0)=t_tx;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<257>");
	m_mat->m_grid.At(3).At(1)=-t_ty;
	return 0;
}
int c_MojoEmulationDevice::SetScissor(int t_x,int t_y,int t_width,int t_height){
	DBG_ENTER("MojoEmulationDevice.SetScissor")
	c_MojoEmulationDevice *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_x,"x")
	DBG_LOCAL(t_y,"y")
	DBG_LOCAL(t_width,"width")
	DBG_LOCAL(t_height,"height")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<261>");
	c_TRender::m_camera2D->p_CameraScissor(t_x,t_y,t_width,t_height);
	return 0;
}
int c_MojoEmulationDevice::SetBlend(int t_blend){
	DBG_ENTER("MojoEmulationDevice.SetBlend")
	c_MojoEmulationDevice *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_blend,"blend")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<266>");
	if(t_blend!=m_lastBlend){
		DBG_BLOCK();
		p_NewLayer();
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<268>");
	if(t_blend==1){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<269>");
		m_solid.At(m_layer)->m_brush->m_blend=3;
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<270>");
		if(t_blend==1){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<271>");
			m_solid.At(m_layer)->m_brush->m_blend=4;
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<273>");
			m_solid.At(m_layer)->m_brush->m_blend=1;
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<279>");
	m_lastBlend=t_blend;
	return 0;
}
int c_MojoEmulationDevice::p_Check(c_MojoSurface* t_s){
	DBG_ENTER("MojoEmulationDevice.Check")
	c_MojoEmulationDevice *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_s,"s")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<181>");
	if(t_s!=m_lastSurface){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<182>");
		p_NewLayer();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<183>");
		gc_assign(m_lastSurface,t_s);
	}
	return 0;
}
void c_MojoEmulationDevice::p_AddQuad(c_TSurface* t_s,Float t_x,Float t_y,Float t_w,Float t_h,Float t_u,Float t_v,Float t_uw,Float t_vh){
	DBG_ENTER("MojoEmulationDevice.AddQuad")
	c_MojoEmulationDevice *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_s,"s")
	DBG_LOCAL(t_x,"x")
	DBG_LOCAL(t_y,"y")
	DBG_LOCAL(t_w,"w")
	DBG_LOCAL(t_h,"h")
	DBG_LOCAL(t_u,"u")
	DBG_LOCAL(t_v,"v")
	DBG_LOCAL(t_uw,"uw")
	DBG_LOCAL(t_vh,"vh")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<460>");
	Array<Float > t_p0=Array<Float >();
	Array<Float > t_p1=Array<Float >();
	Array<Float > t_p2=Array<Float >();
	Array<Float > t_p3=Array<Float >();
	DBG_LOCAL(t_p0,"p0")
	DBG_LOCAL(t_p1,"p1")
	DBG_LOCAL(t_p2,"p2")
	DBG_LOCAL(t_p3,"p3")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<461>");
	Float t_r=FLOAT(.0);
	Float t_g=FLOAT(.0);
	Float t_b=FLOAT(.0);
	DBG_LOCAL(t_r,"r")
	DBG_LOCAL(t_g,"g")
	DBG_LOCAL(t_b,"b")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<463>");
	t_p0=bb_mojographics_Transform2D(m_mat,t_x,-t_h-t_y,m_zdepth);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<464>");
	t_p1=bb_mojographics_Transform2D(m_mat,t_x,-t_y,m_zdepth);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<465>");
	t_p2=bb_mojographics_Transform2D(m_mat,t_x+t_w,-t_y,m_zdepth);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<466>");
	t_p3=bb_mojographics_Transform2D(m_mat,t_x+t_w,-t_h-t_y,m_zdepth);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<467>");
	t_r=Float(m_colorr)*FLOAT(0.0039215686274509803);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<468>");
	t_g=Float(m_colorg)*FLOAT(0.0039215686274509803);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<469>");
	t_b=Float(m_colorb)*FLOAT(0.0039215686274509803);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<475>");
	Float t_[]={t_p0.At(0),t_p0.At(1),-t_p0.At(2),FLOAT(0.0),FLOAT(1.0),FLOAT(1.0),FLOAT(1.0),FLOAT(0.0),t_r,t_g,t_b,m_colora,t_u,t_vh,t_u,t_vh,t_p1.At(0),t_p1.At(1),-t_p1.At(2),FLOAT(0.0),FLOAT(1.0),FLOAT(1.0),FLOAT(1.0),FLOAT(0.0),t_r,t_g,t_b,m_colora,t_u,t_v,t_u,t_v,t_p2.At(0),t_p2.At(1),-t_p2.At(2),FLOAT(0.0),FLOAT(1.0),FLOAT(1.0),FLOAT(1.0),FLOAT(0.0),t_r,t_g,t_b,m_colora,t_uw,t_v,t_uw,t_v,t_p3.At(0),t_p3.At(1),-t_p3.At(2),FLOAT(0.0),FLOAT(1.0),FLOAT(1.0),FLOAT(1.0),FLOAT(0.0),t_r,t_g,t_b,m_colora,t_uw,t_vh,t_uw,t_vh};
	m__quadCache->p_AddCache(t_s,Array<Float >(t_,64));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<482>");
	t_s->m_reset_vbo=-1;
}
int c_MojoEmulationDevice::DrawPoint(Float t_x,Float t_y){
	DBG_ENTER("MojoEmulationDevice.DrawPoint")
	c_MojoEmulationDevice *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_x,"x")
	DBG_LOCAL(t_y,"y")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<284>");
	p_Check(0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<285>");
	p_AddQuad(m_solid.At(m_layer),t_x,t_y,FLOAT(1.0),FLOAT(1.0),FLOAT(0.0),FLOAT(0.0),FLOAT(1.0),FLOAT(1.0));
	return 0;
}
int c_MojoEmulationDevice::DrawRect(Float t_x,Float t_y,Float t_w,Float t_h){
	DBG_ENTER("MojoEmulationDevice.DrawRect")
	c_MojoEmulationDevice *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_x,"x")
	DBG_LOCAL(t_y,"y")
	DBG_LOCAL(t_w,"w")
	DBG_LOCAL(t_h,"h")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<291>");
	p_Check(0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<292>");
	p_AddQuad(m_solid.At(m_layer),t_x,t_y,t_w,t_h,FLOAT(0.0),FLOAT(0.0),FLOAT(1.0),FLOAT(1.0));
	return 0;
}
int c_MojoEmulationDevice::DrawLine(Float t_x1,Float t_y1,Float t_x2,Float t_y2){
	DBG_ENTER("MojoEmulationDevice.DrawLine")
	c_MojoEmulationDevice *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_x1,"x1")
	DBG_LOCAL(t_y1,"y1")
	DBG_LOCAL(t_x2,"x2")
	DBG_LOCAL(t_y2,"y2")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<298>");
	p_Check(0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<300>");
	Array<Float > t_p0=Array<Float >();
	DBG_LOCAL(t_p0,"p0")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<301>");
	t_p0=bb_mojographics_Transform2D(m_mat,t_x1,-t_y1,m_zdepth);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<302>");
	t_x1=t_p0.At(0);
	t_y1=t_p0.At(1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<303>");
	t_p0=bb_mojographics_Transform2D(m_mat,t_x2,-t_y2,m_zdepth);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<304>");
	t_x2=t_p0.At(0);
	t_y2=t_p0.At(1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<306>");
	Float t_px=t_y1-t_y2;
	DBG_LOCAL(t_px,"px")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<307>");
	Float t_py=-(t_x1-t_x2);
	DBG_LOCAL(t_py,"py")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<308>");
	Float t_d=FLOAT(1.0)/(Float)sqrt(t_px*t_px+t_py*t_py);
	DBG_LOCAL(t_d,"d")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<310>");
	t_px=t_px*t_d;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<311>");
	t_py=t_py*t_d;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<313>");
	int t_v0=m_solid.At(m_layer)->p_AddVertex(t_x2,t_y2,m_zdepth,FLOAT(0.0),FLOAT(1.0),FLOAT(0.0));
	DBG_LOCAL(t_v0,"v0")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<314>");
	int t_v1=m_solid.At(m_layer)->p_AddVertex(t_x1,t_y1,m_zdepth,FLOAT(0.0),FLOAT(0.0),FLOAT(0.0));
	DBG_LOCAL(t_v1,"v1")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<315>");
	int t_v2=m_solid.At(m_layer)->p_AddVertex(t_x1+t_px,t_y1+t_py,m_zdepth,FLOAT(1.0),FLOAT(0.0),FLOAT(0.0));
	DBG_LOCAL(t_v2,"v2")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<316>");
	m_solid.At(m_layer)->p_AddTriangle(t_v0,t_v1,t_v2);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<318>");
	int t_v3=m_solid.At(m_layer)->p_AddVertex(t_x2+t_px,t_y2+t_py,m_zdepth,FLOAT(1.0),FLOAT(0.0),FLOAT(0.0));
	DBG_LOCAL(t_v3,"v3")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<319>");
	m_solid.At(m_layer)->p_AddTriangle(t_v0,t_v2,t_v3);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<321>");
	m_solid.At(m_layer)->p_VertexColor(t_v0,Float(m_colorr),Float(m_colorg),Float(m_colorb),m_colora);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<322>");
	m_solid.At(m_layer)->p_VertexColor(t_v1,Float(m_colorr),Float(m_colorg),Float(m_colorb),m_colora);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<323>");
	m_solid.At(m_layer)->p_VertexColor(t_v2,Float(m_colorr),Float(m_colorg),Float(m_colorb),m_colora);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<324>");
	m_solid.At(m_layer)->p_VertexColor(t_v3,Float(m_colorr),Float(m_colorg),Float(m_colorb),m_colora);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<327>");
	m_solid.At(m_layer)->m_reset_vbo=-1;
	return 0;
}
int c_MojoEmulationDevice::DrawPoly(Array<Float > t_verts){
	DBG_ENTER("MojoEmulationDevice.DrawPoly")
	c_MojoEmulationDevice *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_verts,"verts")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<367>");
	p_Check(0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<369>");
	Array<Float > t_p0=Array<Float >();
	Array<Float > t_p1=Array<Float >();
	Array<Float > t_p2=Array<Float >();
	Array<Float > t_p3=Array<Float >();
	DBG_LOCAL(t_p0,"p0")
	DBG_LOCAL(t_p1,"p1")
	DBG_LOCAL(t_p2,"p2")
	DBG_LOCAL(t_p3,"p3")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<370>");
	Float t_r=FLOAT(.0);
	Float t_g=FLOAT(.0);
	Float t_b=FLOAT(.0);
	DBG_LOCAL(t_r,"r")
	DBG_LOCAL(t_g,"g")
	DBG_LOCAL(t_b,"b")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<372>");
	Array<int > t_tris=Array<int >((t_verts.Length()-7)*6*3);
	DBG_LOCAL(t_tris,"tris")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<373>");
	int t_t=0;
	int t_vt=m_solid.At(m_layer)->m_no_verts;
	DBG_LOCAL(t_t,"t")
	DBG_LOCAL(t_vt,"vt")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<377>");
	t_r=Float(m_colorr)*FLOAT(0.0039215686274509803);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<378>");
	t_g=Float(m_colorg)*FLOAT(0.0039215686274509803);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<379>");
	t_b=Float(m_colorb)*FLOAT(0.0039215686274509803);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<381>");
	for(int t_i=0;t_i<=t_verts.Length()-7;t_i=t_i+6){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<382>");
		t_p0=bb_mojographics_Transform2D(m_mat,t_verts.At(t_i+0),-t_verts.At(t_i+1),m_zdepth);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<383>");
		t_p1=bb_mojographics_Transform2D(m_mat,t_verts.At(t_i+2),-t_verts.At(t_i+3),m_zdepth);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<384>");
		t_p2=bb_mojographics_Transform2D(m_mat,t_verts.At(t_i+4),-t_verts.At(t_i+5),m_zdepth);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<387>");
		t_vt=t_vt+3;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<403>");
		Float t_[]={t_p0.At(0),t_p0.At(1),-t_p0.At(2),FLOAT(0.0),FLOAT(1.0),FLOAT(1.0),FLOAT(1.0),FLOAT(0.0),Float(m_colorr)*FLOAT(0.0039215686274509803),Float(m_colorg)*FLOAT(0.0039215686274509803),Float(m_colorb)*FLOAT(0.0039215686274509803),m_colora,FLOAT(0.0),FLOAT(0.0),FLOAT(0.0),FLOAT(0.0),t_p1.At(0),t_p1.At(1),-t_p1.At(2),FLOAT(0.0),FLOAT(1.0),FLOAT(1.0),FLOAT(1.0),FLOAT(0.0),Float(m_colorr)*FLOAT(0.0039215686274509803),Float(m_colorg)*FLOAT(0.0039215686274509803),Float(m_colorb)*FLOAT(0.0039215686274509803),m_colora,FLOAT(0.0),FLOAT(0.0),FLOAT(0.0),FLOAT(0.0),t_p2.At(0),t_p2.At(1),-t_p2.At(2),FLOAT(0.0),FLOAT(1.0),FLOAT(1.0),FLOAT(1.0),FLOAT(0.0),Float(m_colorr)*FLOAT(0.0039215686274509803),Float(m_colorg)*FLOAT(0.0039215686274509803),Float(m_colorb)*FLOAT(0.0039215686274509803),m_colora,FLOAT(0.0),FLOAT(0.0),FLOAT(0.0),FLOAT(0.0)};
		m_solid.At(m_layer)->p_AddVertex2(Array<Float >(t_,48),-1);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<409>");
		t_tris.At(t_t)=t_vt-3;
		t_tris.At(t_t+1)=t_vt-2;
		t_tris.At(t_t+2)=t_vt-1;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<410>");
		t_t=t_t+3;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<416>");
	m_solid.At(m_layer)->p_AddTriangle2(t_tris,-1);
	return 0;
}
int c_MojoEmulationDevice::DrawOval(Float t_x,Float t_y,Float t_w,Float t_h){
	DBG_ENTER("MojoEmulationDevice.DrawOval")
	c_MojoEmulationDevice *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_x,"x")
	DBG_LOCAL(t_y,"y")
	DBG_LOCAL(t_w,"w")
	DBG_LOCAL(t_h,"h")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<333>");
	p_Check(0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<335>");
	if(t_w<FLOAT(0.0)){
		DBG_BLOCK();
		t_w=-t_w;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<336>");
	if(t_h<FLOAT(0.0)){
		DBG_BLOCK();
		t_h=-t_h;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<337>");
	int t_seg=int((t_w+t_h)*FLOAT(0.2));
	DBG_LOCAL(t_seg,"seg")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<338>");
	if(t_seg<14){
		DBG_BLOCK();
		t_seg=14;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<340>");
	Float t_deg=FLOAT(0.0);
	Float t_deginc=FLOAT(360.0)/Float(t_seg);
	DBG_LOCAL(t_deg,"deg")
	DBG_LOCAL(t_deginc,"deginc")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<341>");
	Array<Float > t_verts=Array<Float >(t_seg*6+1);
	DBG_LOCAL(t_verts,"verts")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<343>");
	for(int t_i=0;t_i<=t_verts.Length()-7;t_i=t_i+6){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<345>");
		t_verts.At(t_i+0)=t_x;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<346>");
		t_verts.At(t_i+1)=t_y;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<347>");
		t_verts.At(t_i+2)=t_x+t_w*(Float)cos((t_deg)*D2R);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<348>");
		t_verts.At(t_i+3)=t_y+t_h*(Float)sin((t_deg)*D2R);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<349>");
		t_verts.At(t_i+4)=t_x+t_w*(Float)cos((t_deg+t_deginc)*D2R);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<350>");
		t_verts.At(t_i+5)=t_y+t_h*(Float)sin((t_deg+t_deginc)*D2R);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<352>");
		t_deg+=t_deginc;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<356>");
	DrawPoly(t_verts);
	return 0;
}
int c_MojoEmulationDevice::DrawSurface2(gxtkSurface* t_surface,Float t_x,Float t_y,int t_srcx,int t_srcy,int t_srcw,int t_srch){
	DBG_ENTER("MojoEmulationDevice.DrawSurface2")
	c_MojoEmulationDevice *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_surface,"surface")
	DBG_LOCAL(t_x,"x")
	DBG_LOCAL(t_y,"y")
	DBG_LOCAL(t_srcx,"srcx")
	DBG_LOCAL(t_srcy,"srcy")
	DBG_LOCAL(t_srcw,"srcw")
	DBG_LOCAL(t_srch,"srch")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<427>");
	c_MojoSurface* t_s=dynamic_cast<c_MojoSurface*>(t_surface);
	DBG_LOCAL(t_s,"s")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<428>");
	if(!((t_s)!=0)){
		DBG_BLOCK();
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<430>");
	p_Check(t_s);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<432>");
	if((t_s->m_tex)!=0){
		DBG_BLOCK();
		m_solid.At(m_layer)->p_PaintSurface2(t_s->m_tex,0);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<435>");
	Float t_xstep=t_s->m_xstep;
	DBG_LOCAL(t_xstep,"xstep")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<436>");
	Float t_ystep=t_s->m_ystep;
	DBG_LOCAL(t_ystep,"ystep")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<437>");
	Float t_upos=Float(t_srcx)*t_xstep;
	DBG_LOCAL(t_upos,"upos")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<438>");
	Float t_vpos=Float(t_srcy)*t_ystep;
	DBG_LOCAL(t_vpos,"vpos")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<440>");
	p_AddQuad(m_solid.At(m_layer),t_x,t_y,Float(t_srcw),Float(t_srch),t_upos,t_vpos,t_upos+t_xstep*Float(t_srcw),t_vpos+t_ystep*Float(t_srch));
	return 0;
}
int c_MojoEmulationDevice::DrawSurface(gxtkSurface* t_surface,Float t_x,Float t_y){
	DBG_ENTER("MojoEmulationDevice.DrawSurface")
	c_MojoEmulationDevice *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_surface,"surface")
	DBG_LOCAL(t_x,"x")
	DBG_LOCAL(t_y,"y")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<421>");
	DrawSurface2(t_surface,t_x,t_y,0,0,t_surface->Width(),t_surface->Height());
	return 0;
}
int c_MojoEmulationDevice::ReadPixels(Array<int > t_pixels,int t_x,int t_y,int t_width,int t_height,int t_offset,int t_pitch){
	DBG_ENTER("MojoEmulationDevice.ReadPixels")
	c_MojoEmulationDevice *self=this;
	DBG_LOCAL(self,"Self")
	return 0;
}
void c_MojoEmulationDevice::mark(){
	gxtkGraphics::mark();
	gc_mark_q(m_mesh);
	gc_mark_q(m_solid);
	gc_mark_q(m_lastSurface);
	gc_mark_q(m_mat);
	gc_mark_q(m_fontImage);
}
String c_MojoEmulationDevice::debug(){
	String t="(MojoEmulationDevice)\n";
	t+=dbg_decl("_device",&c_MojoEmulationDevice::m__device);
	t+=dbg_decl("_olddevice",&c_MojoEmulationDevice::m__olddevice);
	t+=dbg_decl("_quadCache",&c_MojoEmulationDevice::m__quadCache);
	t+=dbg_decl("mesh",&m_mesh);
	t+=dbg_decl("solid",&m_solid);
	t+=dbg_decl("layer",&m_layer);
	t+=dbg_decl("zdepth",&m_zdepth);
	t+=dbg_decl("colorr",&m_colorr);
	t+=dbg_decl("colorg",&m_colorg);
	t+=dbg_decl("colorb",&m_colorb);
	t+=dbg_decl("colora",&m_colora);
	t+=dbg_decl("mat",&m_mat);
	t+=dbg_decl("lastSurface",&m_lastSurface);
	t+=dbg_decl("lastBlend",&m_lastBlend);
	t+=dbg_decl("fontImage",&m_fontImage);
	t+=dbg_decl("fontFile",&m_fontFile);
	t+=dbg_decl("firstTimeRun",&c_MojoEmulationDevice::m_firstTimeRun);
	return t;
}
gxtkGraphics* bb_graphics_GetGraphicsDevice(){
	DBG_ENTER("GetGraphicsDevice")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/graphics.monkey<67>");
	return bb_graphics_device;
}
c_QuadCache::c_QuadCache(){
	m_q_num=0;
	m_q_cache=Array<Float >(1280);
	m_q_surf=0;
	m_q_tri=Array<int >(128);
}
c_QuadCache* c_QuadCache::m_new(){
	DBG_ENTER("QuadCache.new")
	c_QuadCache *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<598>");
	return this;
}
void c_QuadCache::p_FlushCache(){
	DBG_ENTER("QuadCache.FlushCache")
	c_QuadCache *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<627>");
	if(m_q_num==0){
		DBG_BLOCK();
		return;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<629>");
	int t_n=m_q_num;
	DBG_LOCAL(t_n,"n")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<630>");
	int t_v4=m_q_surf->p_AddVertex2(m_q_cache,m_q_num*64);
	DBG_LOCAL(t_v4,"v4")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<632>");
	t_v4=t_v4+1-m_q_num*4;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<635>");
	int t_k=0;
	DBG_LOCAL(t_k,"k")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<636>");
	for(int t_j=0;t_j<=t_n-1;t_j=t_j+1){
		DBG_BLOCK();
		DBG_LOCAL(t_j,"j")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<637>");
		m_q_tri.At(t_k+0)=t_v4;
		m_q_tri.At(t_k+1)=t_v4+1;
		m_q_tri.At(t_k+2)=t_v4+2;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<638>");
		m_q_tri.At(t_k+3)=t_v4;
		m_q_tri.At(t_k+4)=t_v4+2;
		m_q_tri.At(t_k+5)=t_v4+3;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<640>");
		t_k=t_k+6;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<641>");
		t_v4=t_v4+4;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<643>");
	m_q_surf->p_AddTriangle2(m_q_tri,m_q_num*6);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<645>");
	m_q_num=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<646>");
	m_q_surf=0;
}
void c_QuadCache::p_AddCache(c_TSurface* t_s,Array<Float > t_v){
	DBG_ENTER("QuadCache.AddCache")
	c_QuadCache *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_s,"s")
	DBG_LOCAL(t_v,"v")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<609>");
	if(t_s!=m_q_surf || m_q_num>19){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<611>");
		p_FlushCache();
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<614>");
	gc_assign(m_q_surf,t_s);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<616>");
	int t_offset=m_q_num*64;
	DBG_LOCAL(t_offset,"offset")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<617>");
	for(int t_i=0;t_i<=63;t_i=t_i+1){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<618>");
		m_q_cache.At(t_offset+t_i)=t_v.At(t_i);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<621>");
	m_q_num+=1;
}
void c_QuadCache::mark(){
	Object::mark();
	gc_mark_q(m_q_cache);
	gc_mark_q(m_q_surf);
	gc_mark_q(m_q_tri);
}
String c_QuadCache::debug(){
	String t="(QuadCache)\n";
	t+=dbg_decl("q_cache",&m_q_cache);
	t+=dbg_decl("q_tri",&m_q_tri);
	t+=dbg_decl("q_num",&m_q_num);
	t+=dbg_decl("q_surf",&m_q_surf);
	return t;
}
c_TEntity::c_TEntity(){
	m_mat=(new c_Matrix)->m_new();
	m_loc_mat=(new c_Matrix)->m_new();
	m_classname=String();
	m_parent=0;
	m_px=FLOAT(.0);
	m_py=FLOAT(.0);
	m_pz=FLOAT(.0);
	m_rx=FLOAT(.0);
	m_ry=FLOAT(.0);
	m_rz=FLOAT(.0);
	m_sx=FLOAT(1.0);
	m_sy=FLOAT(1.0);
	m_sz=FLOAT(1.0);
	m_gsx=FLOAT(1.0);
	m_gsy=FLOAT(1.0);
	m_gsz=FLOAT(1.0);
	m_collision=(new c_TCollision)->m_new();
	m_child_list=(new c_EntityList)->m_new();
	m_parent_link=0;
	m_order=0;
	m_entity_link=0;
	m_brush=(new c_TBrush)->m_new();
	m_hide=false;
	m_name=String();
	m_use_cam_layer=false;
	m_cam_layer=0;
	m_cull_radius=FLOAT(.0);
	m_auto_fade=0;
	m_fade_near=FLOAT(.0);
	m_fade_far=FLOAT(.0);
	m_fade_alpha=FLOAT(.0);
	m_using_alpha=false;
	m_alpha_order=FLOAT(.0);
	m_anim=0;
	m_anim_render=0;
}
c_TEntity* c_TEntity::m_new(){
	DBG_ENTER("TEntity.new")
	c_TEntity *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<133>");
	m_mat->p_LoadIdentity();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<134>");
	m_loc_mat->p_LoadIdentity();
	return this;
}
void c_TEntity::p_UpdateMat(bool t_load_identity){
	DBG_ENTER("TEntity.UpdateMat")
	c_TEntity *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_load_identity,"load_identity")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2110>");
	if(t_load_identity==true){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2111>");
		m_mat->p_LoadIdentity();
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2114>");
	if(t_load_identity==false && ((m_parent)!=0)){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2116>");
		m_mat->p_Overwrite(m_parent->m_mat);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2119>");
	m_mat->p_Translate(m_px,m_py,m_pz);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2120>");
	m_mat->p_Rotate(m_rx,m_ry,m_rz);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2121>");
	m_mat->p_Scale(m_sx,m_sy,m_sz);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2127>");
	if(t_load_identity){
		DBG_BLOCK();
		m_loc_mat->p_Overwrite(m_mat);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2129>");
	if((m_parent)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2130>");
		m_gsx=m_parent->m_gsx*m_sx;
		m_gsy=m_parent->m_gsy*m_sy;
		m_gsz=m_parent->m_gsz*m_sz;
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2132>");
		m_gsx=m_sx;
		m_gsy=m_sy;
		m_gsz=m_sz;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2135>");
	m_collision->m_updated_shape=false;
}
int c_TEntity::p_AddParent(c_TEntity* t_parent_ent){
	DBG_ENTER("TEntity.AddParent")
	c_TEntity *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_parent_ent,"parent_ent")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1212>");
	gc_assign(m_parent,t_parent_ent);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1215>");
	if(m_parent!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1217>");
		m_mat->p_Overwrite(m_parent->m_mat);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1218>");
		this->p_UpdateMat(false);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1220>");
		gc_assign(m_parent_link,m_parent->m_child_list->p_AddLast(this));
	}
	return 0;
}
c_EntityList* c_TEntity::m_entity_list;
c_TEntity* c_TEntity::p_EntityFX(int t_fx_no){
	DBG_ENTER("TEntity.EntityFX")
	c_TEntity *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_fx_no,"fx_no")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1002>");
	m_brush->m_fx=t_fx_no;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1003>");
	return this;
}
int c_TEntity::p_EntityFX2(){
	DBG_ENTER("TEntity.EntityFX")
	c_TEntity *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1008>");
	return m_brush->m_fx;
}
bool c_TEntity::p_Hidden(){
	DBG_ENTER("TEntity.Hidden")
	c_TEntity *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1127>");
	return m_hide;
}
Float c_TEntity::p_EntityX(int t_glob){
	DBG_ENTER("TEntity.EntityX")
	c_TEntity *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_glob,"glob")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1239>");
	if(t_glob==0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1241>");
		return m_px;
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1245>");
		return m_mat->m_grid.At(3).At(0);
	}
}
Float c_TEntity::p_EntityY(int t_glob){
	DBG_ENTER("TEntity.EntityY")
	c_TEntity *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_glob,"glob")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1253>");
	if(t_glob==0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1255>");
		return m_py;
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1259>");
		return m_mat->m_grid.At(3).At(1);
	}
}
Float c_TEntity::p_EntityZ(int t_glob){
	DBG_ENTER("TEntity.EntityZ")
	c_TEntity *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_glob,"glob")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1267>");
	if(t_glob==0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1269>");
		Float t_=-m_pz;
		return t_;
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1273>");
		Float t_2=-m_mat->m_grid.At(3).At(2);
		return t_2;
	}
}
Float c_TEntity::p_EntityDistanceSquared(c_TEntity* t_ent2){
	DBG_ENTER("TEntity.EntityDistanceSquared")
	c_TEntity *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_ent2,"ent2")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1469>");
	Float t_xd=t_ent2->m_mat->m_grid.At(3).At(0)-m_mat->m_grid.At(3).At(0);
	DBG_LOCAL(t_xd,"xd")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1470>");
	Float t_yd=t_ent2->m_mat->m_grid.At(3).At(1)-m_mat->m_grid.At(3).At(1);
	DBG_LOCAL(t_yd,"yd")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1471>");
	Float t_zd=-t_ent2->m_mat->m_grid.At(3).At(2)+m_mat->m_grid.At(3).At(2);
	DBG_LOCAL(t_zd,"zd")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1473>");
	Float t_=t_xd*t_xd+t_yd*t_yd+t_zd*t_zd;
	return t_;
}
Float c_TEntity::p_EntityDistance(c_TEntity* t_ent2){
	DBG_ENTER("TEntity.EntityDistance")
	c_TEntity *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_ent2,"ent2")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1463>");
	Float t_=(Float)sqrt(this->p_EntityDistanceSquared(t_ent2));
	return t_;
}
Float c_TEntity::p_X(){
	DBG_ENTER("TEntity.X")
	c_TEntity *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<269>");
	return m_mat->m_grid.At(3).At(0);
}
void c_TEntity::p_X2(Float t_xx){
	DBG_ENTER("TEntity.X")
	c_TEntity *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_xx,"xx")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<278>");
	m_mat->m_grid.At(3).At(0)=t_xx;
}
Float c_TEntity::p_Y(){
	DBG_ENTER("TEntity.Y")
	c_TEntity *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<272>");
	return m_mat->m_grid.At(3).At(1);
}
void c_TEntity::p_Y2(Float t_yy){
	DBG_ENTER("TEntity.Y")
	c_TEntity *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_yy,"yy")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<281>");
	m_mat->m_grid.At(3).At(1)=t_yy;
}
Float c_TEntity::p_Z(){
	DBG_ENTER("TEntity.Z")
	c_TEntity *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<275>");
	Float t_=-m_mat->m_grid.At(3).At(2);
	return t_;
}
void c_TEntity::p_Z2(Float t_zz){
	DBG_ENTER("TEntity.Z")
	c_TEntity *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_zz,"zz")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<284>");
	m_mat->m_grid.At(3).At(2)=-t_zz;
}
c_Matrix* c_TEntity::m_temp_mat;
int c_TEntity::p_UpdateMatTrans(bool t_load_identity){
	DBG_ENTER("TEntity.UpdateMatTrans")
	c_TEntity *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_load_identity,"load_identity")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2145>");
	if(t_load_identity==false && ((m_parent)!=0)){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2147>");
		m_mat->m_grid.At(3).At(0)=m_parent->m_mat->m_grid.At(0).At(0)*m_px+m_parent->m_mat->m_grid.At(1).At(0)*m_py+m_parent->m_mat->m_grid.At(2).At(0)*m_pz+m_parent->m_mat->m_grid.At(3).At(0);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2148>");
		m_mat->m_grid.At(3).At(1)=m_parent->m_mat->m_grid.At(0).At(1)*m_px+m_parent->m_mat->m_grid.At(1).At(1)*m_py+m_parent->m_mat->m_grid.At(2).At(1)*m_pz+m_parent->m_mat->m_grid.At(3).At(1);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2149>");
		m_mat->m_grid.At(3).At(2)=m_parent->m_mat->m_grid.At(0).At(2)*m_px+m_parent->m_mat->m_grid.At(1).At(2)*m_py+m_parent->m_mat->m_grid.At(2).At(2)*m_pz+m_parent->m_mat->m_grid.At(3).At(2);
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2152>");
		m_mat->m_grid.At(3).At(0)=m_px;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2153>");
		m_mat->m_grid.At(3).At(1)=m_py;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2154>");
		m_mat->m_grid.At(3).At(2)=m_pz;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2158>");
	if(t_load_identity){
		DBG_BLOCK();
		m_loc_mat->p_Overwrite(m_mat);
	}
	return 0;
}
int c_TEntity::m_UpdateChildren(c_TEntity* t_ent_p,int t_type){
	DBG_ENTER("TEntity.UpdateChildren")
	DBG_LOCAL(t_ent_p,"ent_p")
	DBG_LOCAL(t_type,"type")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2194>");
	c_Enumerator7* t_=t_ent_p->m_child_list->p_ObjectEnumerator();
	while(t_->p_HasNext()){
		DBG_BLOCK();
		c_TEntity* t_ent_c=t_->p_NextObject();
		DBG_LOCAL(t_ent_c,"ent_c")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2197>");
		if(dynamic_cast<c_TBone*>(t_ent_c)==0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2200>");
			if(t_type==0){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2201>");
				t_ent_c->m_mat->p_Overwrite(t_ent_p->m_mat);
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2202>");
				t_ent_c->p_UpdateMat(false);
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2203>");
				if(t_type==1){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2204>");
					t_ent_c->p_UpdateMatTrans(false);
				}else{
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2206>");
					t_ent_c->m_mat->p_Overwrite(t_ent_p->m_mat);
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2207>");
					t_ent_c->p_UpdateMat(false);
				}
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2211>");
			m_UpdateChildren(t_ent_c,t_type);
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2215>");
			dynamic_cast<c_TBone*>(t_ent_c)->p_UpdateMatrix(t_ent_c->m_loc_mat);
		}
	}
	return 0;
}
c_TEntity* c_TEntity::p_PositionEntity(Float t_x,Float t_y,Float t_z,int t_glob){
	DBG_ENTER("TEntity.PositionEntity")
	c_TEntity *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_x,"x")
	DBG_LOCAL(t_y,"y")
	DBG_LOCAL(t_z,"z")
	DBG_LOCAL(t_glob,"glob")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<304>");
	t_z=-t_z;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<308>");
	if(t_glob==1 && m_parent!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<310>");
		gc_assign(m_temp_mat,m_parent->m_mat->p_Copy()->p_Inverse());
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<312>");
		Float t_psx=m_parent->m_gsx;
		DBG_LOCAL(t_psx,"psx")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<313>");
		Float t_psy=m_parent->m_gsy;
		DBG_LOCAL(t_psy,"psy")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<314>");
		Float t_psz=m_parent->m_gsz;
		DBG_LOCAL(t_psz,"psz")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<317>");
		Array<Float > t_pos=m_temp_mat->p_TransformPoint(t_x,t_y,t_z,FLOAT(1.0));
		DBG_LOCAL(t_pos,"pos")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<319>");
		t_x=t_pos.At(0)/(t_psx*t_psx);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<320>");
		t_y=t_pos.At(1)/(t_psy*t_psy);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<321>");
		t_z=t_pos.At(2)/(t_psz*t_psz);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<325>");
	if(dynamic_cast<c_TBone*>(this)!=0){
		DBG_BLOCK();
		dynamic_cast<c_TBone*>(this)->p_PositionBone(t_x,t_y,t_z,t_glob);
		return this;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<327>");
	m_px=t_x;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<328>");
	m_py=t_y;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<329>");
	m_pz=t_z;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<331>");
	if(m_parent!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<335>");
		p_UpdateMatTrans(false);
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<339>");
		p_UpdateMatTrans(true);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<342>");
	if(m_child_list->p_IsEmpty()!=true){
		DBG_BLOCK();
		m_UpdateChildren(this,1);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<344>");
	return this;
}
c_TEntity* c_TEntity::p_PositionEntity2(c_TEntity* t_e){
	DBG_ENTER("TEntity.PositionEntity")
	c_TEntity *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_e,"e")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<297>");
	p_PositionEntity(t_e->p_X(),t_e->p_Y(),t_e->p_Z(),1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<298>");
	return this;
}
Float c_TEntity::p_EntityPitch(int t_glob){
	DBG_ENTER("TEntity.EntityPitch")
	c_TEntity *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_glob,"glob")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1281>");
	if(t_glob==0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1283>");
		Float t_=-m_rx;
		return t_;
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1287>");
		Float t_ang=(Float)(atan2(m_mat->m_grid.At(2).At(1),(Float)sqrt(m_mat->m_grid.At(2).At(0)*m_mat->m_grid.At(2).At(0)+m_mat->m_grid.At(2).At(2)*m_mat->m_grid.At(2).At(2)))*R2D);
		DBG_LOCAL(t_ang,"ang")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1288>");
		if(t_ang<=FLOAT(0.0001) && t_ang>=FLOAT(-0.0001)){
			DBG_BLOCK();
			t_ang=FLOAT(0.0);
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1290>");
		return t_ang;
	}
}
Float c_TEntity::p_EntityYaw(int t_glob){
	DBG_ENTER("TEntity.EntityYaw")
	c_TEntity *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_glob,"glob")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1298>");
	if(t_glob==0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1300>");
		return m_ry;
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1304>");
		Float t_a=m_mat->m_grid.At(2).At(0);
		DBG_LOCAL(t_a,"a")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1305>");
		Float t_b=m_mat->m_grid.At(2).At(2);
		DBG_LOCAL(t_b,"b")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1306>");
		if(t_a<=FLOAT(0.0001) && t_a>=FLOAT(-0.0001)){
			DBG_BLOCK();
			t_a=FLOAT(0.0);
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1307>");
		if(t_b<=FLOAT(0.0001) && t_b>=FLOAT(-0.0001)){
			DBG_BLOCK();
			t_b=FLOAT(0.0);
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1308>");
		Float t_=(Float)(atan2(t_a,t_b)*R2D);
		return t_;
	}
}
Float c_TEntity::p_EntityRoll(int t_glob){
	DBG_ENTER("TEntity.EntityRoll")
	c_TEntity *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_glob,"glob")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1316>");
	if(t_glob==0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1318>");
		return m_rz;
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1322>");
		Float t_a=m_mat->m_grid.At(0).At(1);
		DBG_LOCAL(t_a,"a")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1323>");
		Float t_b=m_mat->m_grid.At(1).At(1);
		DBG_LOCAL(t_b,"b")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1324>");
		if(t_a<=FLOAT(0.0001) && t_a>=FLOAT(-0.0001)){
			DBG_BLOCK();
			t_a=FLOAT(0.0);
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1325>");
		if(t_b<=FLOAT(0.0001) && t_b>=FLOAT(-0.0001)){
			DBG_BLOCK();
			t_b=FLOAT(0.0);
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1326>");
		Float t_=(Float)(atan2(t_a,t_b)*R2D);
		return t_;
	}
}
int c_TEntity::p_UpdateMatRot(bool t_load_identity){
	DBG_ENTER("TEntity.UpdateMatRot")
	c_TEntity *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_load_identity,"load_identity")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2164>");
	if(t_load_identity==false && ((m_parent)!=0)){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2166>");
		m_mat->m_grid.At(0).At(0)=m_parent->m_mat->m_grid.At(0).At(0);
		m_mat->m_grid.At(0).At(1)=m_parent->m_mat->m_grid.At(0).At(1);
		m_mat->m_grid.At(0).At(2)=m_parent->m_mat->m_grid.At(0).At(2);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2167>");
		m_mat->m_grid.At(1).At(0)=m_parent->m_mat->m_grid.At(1).At(0);
		m_mat->m_grid.At(1).At(1)=m_parent->m_mat->m_grid.At(1).At(1);
		m_mat->m_grid.At(1).At(2)=m_parent->m_mat->m_grid.At(1).At(2);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2168>");
		m_mat->m_grid.At(2).At(0)=m_parent->m_mat->m_grid.At(2).At(0);
		m_mat->m_grid.At(2).At(1)=m_parent->m_mat->m_grid.At(2).At(1);
		m_mat->m_grid.At(2).At(2)=m_parent->m_mat->m_grid.At(2).At(2);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2170>");
		m_mat->p_Rotate(m_rx,m_ry,m_rz);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2171>");
		m_mat->p_Scale(m_sx,m_sy,m_sz);
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2173>");
		m_mat->p_FastRotateScale(m_rx,m_ry,m_rz,m_sx,m_sy,m_sz);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2176>");
	if((m_parent)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2177>");
		m_gsx=m_parent->m_gsx*m_sx;
		m_gsy=m_parent->m_gsy*m_sy;
		m_gsz=m_parent->m_gsz*m_sz;
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2179>");
		m_gsx=m_sx;
		m_gsy=m_sy;
		m_gsz=m_sz;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2182>");
	if(t_load_identity){
		DBG_BLOCK();
		m_loc_mat->p_Overwrite(m_mat);
	}
	return 0;
}
c_TEntity* c_TEntity::p_RotateEntity(Float t_x,Float t_y,Float t_z,int t_glob){
	DBG_ENTER("TEntity.RotateEntity")
	c_TEntity *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_x,"x")
	DBG_LOCAL(t_y,"y")
	DBG_LOCAL(t_z,"z")
	DBG_LOCAL(t_glob,"glob")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<449>");
	m_rx=-t_x;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<450>");
	m_ry=t_y;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<451>");
	m_rz=t_z;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<454>");
	if(t_glob==1 && m_parent!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<456>");
		m_rx=m_rx+m_parent->p_EntityPitch(1);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<457>");
		m_ry=m_ry-m_parent->p_EntityYaw(1);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<458>");
		m_rz=m_rz-m_parent->p_EntityRoll(1);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<463>");
	if(dynamic_cast<c_TBone*>(this)!=0){
		DBG_BLOCK();
		dynamic_cast<c_TBone*>(this)->p_RotateBone(m_rx,m_ry,m_rz,t_glob);
		return this;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<465>");
	if(m_parent!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<469>");
		p_UpdateMatRot(false);
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<473>");
		p_UpdateMatRot(true);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<476>");
	if(m_child_list->p_IsEmpty()!=true){
		DBG_BLOCK();
		m_UpdateChildren(this,0);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<477>");
	return this;
}
c_TEntity* c_TEntity::p_RotateEntity2(c_TEntity* t_e){
	DBG_ENTER("TEntity.RotateEntity")
	c_TEntity *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_e,"e")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<443>");
	p_RotateEntity(t_e->m_rx,t_e->m_ry,t_e->m_rz,1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<444>");
	return this;
}
c_TEntity* c_TEntity::p_EntityShininess(Float t_s){
	DBG_ENTER("TEntity.EntityShininess")
	c_TEntity *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_s,"s")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<915>");
	m_brush->m_shine=t_s;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<916>");
	return this;
}
c_TEntity* c_TEntity::p_EntityTexture(c_TTexture* t_texture,int t_frame,int t_index){
	DBG_ENTER("TEntity.EntityTexture")
	c_TEntity *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_texture,"texture")
	DBG_LOCAL(t_frame,"frame")
	DBG_LOCAL(t_index,"index")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<922>");
	gc_assign(m_brush->m_tex.At(t_index),t_texture);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<924>");
	if(t_index+1>m_brush->m_no_texs){
		DBG_BLOCK();
		m_brush->m_no_texs=t_index+1;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<926>");
	if(t_frame<0){
		DBG_BLOCK();
		t_frame=0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<927>");
	if(t_frame>t_texture->m_no_frames-1){
		DBG_BLOCK();
		t_frame=t_texture->m_no_frames-1;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<928>");
	m_brush->m_tex.At(t_index)->m_tex_frame=t_frame;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<930>");
	if(t_frame>0 && t_texture->m_no_frames>1){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<932>");
		int t_x=t_frame % t_texture->m_frame_xstep;
		DBG_LOCAL(t_x,"x")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<933>");
		int t_y=t_frame/t_texture->m_frame_ystep % t_texture->m_frame_ystep;
		DBG_LOCAL(t_y,"y")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<934>");
		m_brush->m_tex.At(t_index)->m_u_pos=Float(t_x)*t_texture->m_frame_ustep;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<935>");
		m_brush->m_tex.At(t_index)->m_v_pos=Float(t_y)*t_texture->m_frame_vstep;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<938>");
	return this;
}
c_TEntity* c_TEntity::p_HideEntity(){
	DBG_ENTER("TEntity.HideEntity")
	c_TEntity *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1116>");
	m_hide=true;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1117>");
	c_Enumerator7* t_=m_child_list->p_ObjectEnumerator();
	while(t_->p_HasNext()){
		DBG_BLOCK();
		c_TEntity* t_ent=t_->p_NextObject();
		DBG_LOCAL(t_ent,"ent")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1118>");
		t_ent->p_HideEntity();
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1121>");
	return this;
}
c_TEntity* c_TEntity::p_MoveEntity(Float t_mx,Float t_my,Float t_mz){
	DBG_ENTER("TEntity.MoveEntity")
	c_TEntity *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_mx,"mx")
	DBG_LOCAL(t_my,"my")
	DBG_LOCAL(t_mz,"mz")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<349>");
	t_mz=-t_mz;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<351>");
	Array<Float > t_n=Array<Float >();
	DBG_LOCAL(t_n,"n")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<353>");
	t_n=m_mat->p_TransformPoint(t_mx/m_gsx,t_my/m_gsy,t_mz/m_gsz,FLOAT(1.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<354>");
	p_PositionEntity(t_n.At(0),t_n.At(1),-t_n.At(2),1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<356>");
	return this;
}
c_TEntity* c_TEntity::p_TurnEntity(Float t_x,Float t_y,Float t_z,int t_glob){
	DBG_ENTER("TEntity.TurnEntity")
	c_TEntity *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_x,"x")
	DBG_LOCAL(t_y,"y")
	DBG_LOCAL(t_z,"z")
	DBG_LOCAL(t_glob,"glob")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<484>");
	if(t_glob==1 && m_parent!=0){
		DBG_BLOCK();
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<488>");
	m_rx=m_rx+-t_x;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<489>");
	m_ry=m_ry+t_y;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<490>");
	m_rz=m_rz+t_z;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<493>");
	if(dynamic_cast<c_TBone*>(this)!=0){
		DBG_BLOCK();
		dynamic_cast<c_TBone*>(this)->p_RotateBone(m_rx,m_ry,m_rz,t_glob);
		return this;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<496>");
	if(m_parent!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<500>");
		p_UpdateMatRot(false);
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<504>");
		p_UpdateMatRot(true);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<507>");
	if(m_child_list->p_IsEmpty()!=true){
		DBG_BLOCK();
		m_UpdateChildren(this,0);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<508>");
	return this;
}
Float c_TEntity::p_EntityScaleX(int t_glob){
	DBG_ENTER("TEntity.EntityScaleX")
	c_TEntity *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_glob,"glob")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1973>");
	if(t_glob==1){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1975>");
		if(m_parent!=0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1977>");
			c_TEntity* t_ent=this;
			DBG_LOCAL(t_ent,"ent")
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1979>");
			Float t_x=m_sx;
			DBG_LOCAL(t_x,"x")
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1981>");
			do{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1983>");
				t_x=t_x*t_ent->m_parent->m_sx;
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1985>");
				t_ent=t_ent->m_parent;
			}while(!(t_ent->m_parent==0));
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1989>");
			return t_x;
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1995>");
	return m_sx;
}
Float c_TEntity::p_EntityScaleY(int t_glob){
	DBG_ENTER("TEntity.EntityScaleY")
	c_TEntity *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_glob,"glob")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2001>");
	if(t_glob==1){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2003>");
		if(m_parent!=0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2005>");
			c_TEntity* t_ent=this;
			DBG_LOCAL(t_ent,"ent")
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2007>");
			Float t_y=m_sy;
			DBG_LOCAL(t_y,"y")
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2009>");
			do{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2011>");
				t_y=t_y*t_ent->m_parent->m_sy;
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2013>");
				t_ent=t_ent->m_parent;
			}while(!(t_ent->m_parent==0));
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2017>");
			return t_y;
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2023>");
	return m_sy;
}
Float c_TEntity::p_EntityScaleZ(int t_glob){
	DBG_ENTER("TEntity.EntityScaleZ")
	c_TEntity *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_glob,"glob")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2029>");
	if(t_glob==1){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2031>");
		if(m_parent!=0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2033>");
			c_TEntity* t_ent=this;
			DBG_LOCAL(t_ent,"ent")
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2035>");
			Float t_z=m_sz;
			DBG_LOCAL(t_z,"z")
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2037>");
			do{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2039>");
				t_z=t_z*t_ent->m_parent->m_sz;
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2041>");
				t_ent=t_ent->m_parent;
			}while(!(t_ent->m_parent==0));
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2045>");
			return t_z;
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2051>");
	return m_sz;
}
c_TEntity* c_TEntity::p_ScaleEntity(Float t_x,Float t_y,Float t_z,int t_glob){
	DBG_ENTER("TEntity.ScaleEntity")
	c_TEntity *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_x,"x")
	DBG_LOCAL(t_y,"y")
	DBG_LOCAL(t_z,"z")
	DBG_LOCAL(t_glob,"glob")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<396>");
	m_sx=t_x;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<397>");
	m_sy=t_y;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<398>");
	m_sz=t_z;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<401>");
	if(t_glob==1 && m_parent!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<403>");
		m_sx=m_sx/m_parent->m_gsx;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<404>");
		m_sy=m_sy/m_parent->m_gsy;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<405>");
		m_sz=m_sz/m_parent->m_gsz;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<410>");
	if(dynamic_cast<c_TBone*>(this)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<412>");
		dynamic_cast<c_TBone*>(this)->p_ScaleBone(m_sx,m_sy,m_sz,t_glob);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<413>");
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<417>");
	if(m_parent!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<421>");
		p_UpdateMatRot(false);
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<426>");
		p_UpdateMatRot(true);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<431>");
	if(m_child_list->p_IsEmpty()!=true){
		DBG_BLOCK();
		m_UpdateChildren(this,0);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<432>");
	return this;
}
c_TEntity* c_TEntity::p_ScaleEntity2(c_TEntity* t_e){
	DBG_ENTER("TEntity.ScaleEntity")
	c_TEntity *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_e,"e")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<390>");
	p_ScaleEntity(t_e->p_EntityScaleX(0),t_e->p_EntityScaleY(0),t_e->p_EntityScaleZ(0),1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<391>");
	return this;
}
c_TEntity* c_TEntity::p_EntityParent(c_TEntity* t_parent_ent,bool t_glob){
	DBG_ENTER("TEntity.EntityParent")
	c_TEntity *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_parent_ent,"parent_ent")
	DBG_LOCAL(t_glob,"glob")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1146>");
	Float t_gpx_=p_EntityX(1);
	DBG_LOCAL(t_gpx_,"gpx_")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1147>");
	Float t_gpy_=p_EntityY(1);
	DBG_LOCAL(t_gpy_,"gpy_")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1148>");
	Float t_gpz_=p_EntityZ(1);
	DBG_LOCAL(t_gpz_,"gpz_")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1150>");
	Float t_grx_=p_EntityPitch(1);
	DBG_LOCAL(t_grx_,"grx_")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1151>");
	Float t_gry_=p_EntityYaw(1);
	DBG_LOCAL(t_gry_,"gry_")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1152>");
	Float t_grz_=p_EntityRoll(1);
	DBG_LOCAL(t_grz_,"grz_")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1159>");
	if(m_parent!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1160>");
		m_parent_link->p_Remove();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1161>");
		m_parent=0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1166>");
	m_px=t_gpx_;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1167>");
	m_py=t_gpy_;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1168>");
	m_pz=-t_gpz_;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1169>");
	m_rx=-t_grx_;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1170>");
	m_ry=t_gry_;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1171>");
	m_rz=t_grz_;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1179>");
	if(t_parent_ent==0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1180>");
		p_UpdateMat(true);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1181>");
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1186>");
	if(t_parent_ent!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1188>");
		if(t_glob){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1190>");
			p_AddParent(t_parent_ent);
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1193>");
			p_PositionEntity(t_gpx_,t_gpy_,t_gpz_,1);
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1194>");
			p_RotateEntity(t_grx_,t_gry_,t_grz_,1);
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1195>");
			p_ScaleEntity(m_gsx,m_gsy,m_gsz,1);
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1199>");
			p_AddParent(t_parent_ent);
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1206>");
	return this;
}
String c_TEntity::p_EntityName(){
	DBG_ENTER("TEntity.EntityName")
	c_TEntity *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<1340>");
	return m_name;
}
c_Matrix* c_TEntity::m_global_mat;
void c_TEntity::mark(){
	Object::mark();
	gc_mark_q(m_mat);
	gc_mark_q(m_loc_mat);
	gc_mark_q(m_parent);
	gc_mark_q(m_collision);
	gc_mark_q(m_child_list);
	gc_mark_q(m_parent_link);
	gc_mark_q(m_entity_link);
	gc_mark_q(m_brush);
	gc_mark_q(m_cam_layer);
}
String c_TEntity::debug(){
	String t="(TEntity)\n";
	t+=dbg_decl("entity_list",&c_TEntity::m_entity_list);
	t+=dbg_decl("child_list",&m_child_list);
	t+=dbg_decl("entity_link",&m_entity_link);
	t+=dbg_decl("parent_link",&m_parent_link);
	t+=dbg_decl("parent",&m_parent);
	t+=dbg_decl("mat",&m_mat);
	t+=dbg_decl("loc_mat",&m_loc_mat);
	t+=dbg_decl("px",&m_px);
	t+=dbg_decl("py",&m_py);
	t+=dbg_decl("pz",&m_pz);
	t+=dbg_decl("sx",&m_sx);
	t+=dbg_decl("sy",&m_sy);
	t+=dbg_decl("sz",&m_sz);
	t+=dbg_decl("rx",&m_rx);
	t+=dbg_decl("ry",&m_ry);
	t+=dbg_decl("rz",&m_rz);
	t+=dbg_decl("gsx",&m_gsx);
	t+=dbg_decl("gsy",&m_gsy);
	t+=dbg_decl("gsz",&m_gsz);
	t+=dbg_decl("name",&m_name);
	t+=dbg_decl("classname",&m_classname);
	t+=dbg_decl("hide",&m_hide);
	t+=dbg_decl("order",&m_order);
	t+=dbg_decl("alpha_order",&m_alpha_order);
	t+=dbg_decl("auto_fade",&m_auto_fade);
	t+=dbg_decl("fade_near",&m_fade_near);
	t+=dbg_decl("fade_far",&m_fade_far);
	t+=dbg_decl("fade_alpha",&m_fade_alpha);
	t+=dbg_decl("using_alpha",&m_using_alpha);
	t+=dbg_decl("cull_radius",&m_cull_radius);
	t+=dbg_decl("brush",&m_brush);
	t+=dbg_decl("anim",&m_anim);
	t+=dbg_decl("anim_render",&m_anim_render);
	t+=dbg_decl("collision",&m_collision);
	t+=dbg_decl("use_cam_layer",&m_use_cam_layer);
	t+=dbg_decl("cam_layer",&m_cam_layer);
	t+=dbg_decl("global_mat",&c_TEntity::m_global_mat);
	t+=dbg_decl("temp_mat",&c_TEntity::m_temp_mat);
	return t;
}
c_TMesh::c_TMesh(){
	m_surf_list=(new c_List2)->m_new();
	m_no_surfs=0;
	m_anim_surf=Array<c_TSurface* >();
	m_anim_surf_frame=Array<int >();
	m_reset_bounds=1;
	m_col_tree=(new c_TColTree)->m_new();
	m_total_tris=0;
	m_min_x=FLOAT(.0);
	m_max_x=FLOAT(.0);
	m_min_y=FLOAT(.0);
	m_max_y=FLOAT(.0);
	m_min_z=FLOAT(.0);
	m_max_z=FLOAT(.0);
	m_vec_temp=(new c_Vector)->m_new(FLOAT(0.0),FLOAT(0.0),FLOAT(0.0));
	m_vecbounds=Array<c_Vector* >(6);
	m_center_x=FLOAT(.0);
	m_center_y=FLOAT(.0);
	m_center_z=FLOAT(.0);
	m_distance_nearplane=FLOAT(.0);
	m_culled=false;
	m_wireframe=false;
	m_is_sprite=false;
}
c_TMesh* c_TMesh::m_new(){
	DBG_ENTER("TMesh.new")
	c_TMesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<50>");
	c_TEntity::m_new();
	return this;
}
c_TMesh* c_TMesh::m_CreateMesh(c_TEntity* t_parent_ent){
	DBG_ENTER("TMesh.CreateMesh")
	DBG_LOCAL(t_parent_ent,"parent_ent")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<203>");
	c_TMesh* t_mesh=(new c_TMesh)->m_new();
	DBG_LOCAL(t_mesh,"mesh")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<205>");
	t_mesh->m_classname=String(L"Mesh",4);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<207>");
	if((t_parent_ent)!=0){
		DBG_BLOCK();
		t_mesh->p_AddParent(t_parent_ent);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<208>");
	gc_assign(t_mesh->m_entity_link,c_TEntity::m_entity_list->p_EntityListAdd(t_mesh));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<211>");
	if(t_mesh->m_parent!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<212>");
		t_mesh->m_mat->p_Overwrite(t_mesh->m_parent->m_mat);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<213>");
		t_mesh->p_UpdateMat(false);
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<215>");
		t_mesh->p_UpdateMat(true);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<218>");
	return t_mesh;
}
int c_TMesh::p_CreateSurfaceID(){
	DBG_ENTER("TMesh.CreateSurfaceID")
	c_TMesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<271>");
	m_no_surfs=m_no_surfs+1;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<272>");
	int t_=m_no_surfs-1;
	return t_;
}
c_TSurface* c_TMesh::p_CreateSurface(c_TBrush* t_bru){
	DBG_ENTER("TMesh.CreateSurface")
	c_TMesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_bru,"bru")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<278>");
	c_TSurface* t_surf=(new c_TSurface)->m_new();
	DBG_LOCAL(t_surf,"surf")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<279>");
	m_surf_list->p_AddLast2(t_surf);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<282>");
	if(t_bru!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<283>");
		gc_assign(t_surf->m_brush,t_bru->p_Copy());
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<287>");
	t_surf->m_surf_id=p_CreateSurfaceID();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<288>");
	gc_assign(m_anim_surf,m_anim_surf.Resize(m_no_surfs));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<289>");
	gc_assign(m_anim_surf_frame,m_anim_surf_frame.Resize(m_no_surfs));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<292>");
	m_reset_bounds=1;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<293>");
	m_col_tree->m_reset_col_tree=1;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<295>");
	return t_surf;
}
c_TSurface* c_TMesh::p_AddSurface(c_TSurface* t_surf){
	DBG_ENTER("TMesh.AddSurface")
	c_TMesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_surf,"surf")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<303>");
	m_surf_list->p_AddLast2(t_surf);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<306>");
	t_surf->m_surf_id=p_CreateSurfaceID();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<307>");
	gc_assign(m_anim_surf,m_anim_surf.Resize(m_no_surfs));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<308>");
	gc_assign(m_anim_surf_frame,m_anim_surf_frame.Resize(m_no_surfs));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<311>");
	m_reset_bounds=1;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<312>");
	m_col_tree->m_reset_col_tree=1;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<314>");
	return t_surf;
}
int c_TMesh::p_GetTotalTris(){
	DBG_ENTER("TMesh.GetTotalTris")
	c_TMesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1816>");
	int t_t=0;
	DBG_LOCAL(t_t,"t")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1817>");
	c_Enumerator8* t_=m_surf_list->p_ObjectEnumerator();
	while(t_->p_HasNext()){
		DBG_BLOCK();
		c_TSurface* t_s=t_->p_NextObject();
		DBG_LOCAL(t_s,"s")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1818>");
		t_t=t_t+t_s->m_no_tris;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1820>");
	return t_t;
}
int c_TMesh::p_GetBounds(bool t_reset){
	DBG_ENTER("TMesh.GetBounds")
	c_TMesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_reset,"reset")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1716>");
	if(m_reset_bounds==1 || t_reset==true){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1719>");
		m_total_tris=p_GetTotalTris();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1721>");
		m_reset_bounds=0;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1723>");
		m_min_x=FLOAT(999999999.0);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1724>");
		m_max_x=FLOAT(-999999999.0);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1725>");
		m_min_y=FLOAT(999999999.0);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1726>");
		m_max_y=FLOAT(-999999999.0);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1727>");
		m_min_z=FLOAT(999999999.0);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1728>");
		m_max_z=FLOAT(-999999999.0);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1729>");
		int t_cc=0;
		DBG_LOCAL(t_cc,"cc")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1731>");
		c_Enumerator8* t_=m_surf_list->p_ObjectEnumerator();
		while(t_->p_HasNext()){
			DBG_BLOCK();
			c_TSurface* t_surf=t_->p_NextObject();
			DBG_LOCAL(t_surf,"surf")
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1733>");
			t_cc+=1;
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1735>");
			for(int t_v=0;t_v<t_surf->m_no_verts;t_v=t_v+1){
				DBG_BLOCK();
				DBG_LOCAL(t_v,"v")
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1737>");
				t_surf->m_vert_data->p_GetVertCoords(m_vec_temp,t_v);
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1739>");
				if(m_vec_temp->m_x<m_min_x){
					DBG_BLOCK();
					m_min_x=m_vec_temp->m_x;
					gc_assign(m_vecbounds.At(0),m_vec_temp->p_Copy());
				}
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1740>");
				if(m_vec_temp->m_x>m_max_x){
					DBG_BLOCK();
					m_max_x=m_vec_temp->m_x;
					gc_assign(m_vecbounds.At(1),m_vec_temp->p_Copy());
				}
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1742>");
				if(m_vec_temp->m_y<m_min_y){
					DBG_BLOCK();
					m_min_y=m_vec_temp->m_y;
					gc_assign(m_vecbounds.At(2),m_vec_temp->p_Copy());
				}
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1743>");
				if(m_vec_temp->m_y>m_max_y){
					DBG_BLOCK();
					m_max_y=m_vec_temp->m_y;
					gc_assign(m_vecbounds.At(3),m_vec_temp->p_Copy());
				}
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1745>");
				if(m_vec_temp->m_z<m_min_z){
					DBG_BLOCK();
					m_min_z=m_vec_temp->m_z;
					gc_assign(m_vecbounds.At(4),m_vec_temp->p_Copy());
				}
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1746>");
				if(m_vec_temp->m_z>m_max_z){
					DBG_BLOCK();
					m_max_z=m_vec_temp->m_z;
					gc_assign(m_vecbounds.At(5),m_vec_temp->p_Copy());
				}
			}
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1754>");
		Float t_width=m_max_x-m_min_x;
		DBG_LOCAL(t_width,"width")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1755>");
		Float t_height=m_max_y-m_min_y;
		DBG_LOCAL(t_height,"height")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1756>");
		Float t_depth=m_max_z-m_min_z;
		DBG_LOCAL(t_depth,"depth")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1757>");
		if(t_cc==0){
			DBG_BLOCK();
			t_width=FLOAT(0.0);
			t_height=FLOAT(0.0);
			t_depth=FLOAT(0.0);
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1762>");
		if(m_cull_radius>=FLOAT(0.0)){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1764>");
			if(t_width>=t_height && t_width>=t_depth){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1765>");
				m_cull_radius=t_width;
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1767>");
				if(t_height>=t_width && t_height>=t_depth){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1768>");
					m_cull_radius=t_height;
				}else{
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1770>");
					m_cull_radius=t_depth;
				}
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1774>");
			m_cull_radius=m_cull_radius*FLOAT(0.5);
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1775>");
			Float t_crs=m_cull_radius*m_cull_radius;
			DBG_LOCAL(t_crs,"crs")
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1776>");
			m_cull_radius=(Float)sqrt(t_crs+t_crs+t_crs);
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1782>");
		m_center_x=m_min_x+t_width*FLOAT(0.5);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1783>");
		m_center_y=m_min_y+t_height*FLOAT(0.5);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1784>");
		m_center_z=m_min_z+t_depth*FLOAT(0.5);
	}
	return 0;
}
int c_TMesh::p_AutoFade(c_TCamera* t_cam){
	DBG_ENTER("TMesh.AutoFade")
	c_TMesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_cam,"cam")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1690>");
	Float t_dist=t_cam->p_EntityDistance(this);
	DBG_LOCAL(t_dist,"dist")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1692>");
	if(t_dist>m_fade_near && t_dist<m_fade_far){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1695>");
		m_fade_alpha=(t_dist-m_fade_near)/(m_fade_far-m_fade_near);
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1700>");
		if(t_dist<m_fade_near){
			DBG_BLOCK();
			m_fade_alpha=FLOAT(0.0);
		}else{
			DBG_BLOCK();
			m_fade_alpha=FLOAT(1.0);
		}
	}
	return 0;
}
bool c_TMesh::p_Alpha(){
	DBG_ENTER("TMesh.Alpha")
	c_TMesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1835>");
	bool t_alpha=false;
	DBG_LOCAL(t_alpha,"alpha")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1838>");
	if(m_brush->m_alpha<FLOAT(1.0) || m_brush->m_blend==2 || m_brush->m_blend==3 || ((m_brush->m_fx&32)!=0)){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1840>");
		t_alpha=true;
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1847>");
		if(m_brush->m_tex.At(0)!=0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1848>");
			if((m_brush->m_tex.At(0)->m_flags&2)!=0){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1849>");
				t_alpha=true;
			}
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1856>");
	c_Enumerator8* t_=m_surf_list->p_ObjectEnumerator();
	while(t_->p_HasNext()){
		DBG_BLOCK();
		c_TSurface* t_surf=t_->p_NextObject();
		DBG_LOCAL(t_surf,"surf")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1858>");
		t_surf->m_alpha_enable=false;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1860>");
		if(t_surf->m_brush!=0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1862>");
			if(t_surf->m_brush->m_alpha<FLOAT(1.0) || t_surf->m_brush->m_blend==2 || t_surf->m_brush->m_blend==3 || ((t_surf->m_brush->m_fx&32)!=0)){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1864>");
				t_alpha=true;
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1868>");
				if(t_surf->m_brush->m_tex.At(0)!=0){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1869>");
					if((t_surf->m_brush->m_tex.At(0)->m_flags&2)!=0){
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1870>");
						t_alpha=true;
					}
				}
			}
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1879>");
		if(m_fade_alpha!=FLOAT(0.0)){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1880>");
			t_alpha=true;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1884>");
		if(t_alpha==true){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1885>");
			t_surf->m_alpha_enable=true;
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1890>");
	m_using_alpha=t_alpha;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1891>");
	return t_alpha;
}
c_TMesh* c_TMesh::m_CreateCube(c_TEntity* t_parent_ent){
	DBG_ENTER("TMesh.CreateCube")
	DBG_LOCAL(t_parent_ent,"parent_ent")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<433>");
	c_TMesh* t_mesh=m_CreateMesh(t_parent_ent);
	DBG_LOCAL(t_mesh,"mesh")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<435>");
	c_TSurface* t_surf=t_mesh->p_CreateSurface(0);
	DBG_LOCAL(t_surf,"surf")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<437>");
	t_surf->p_AddVertex(FLOAT(-1.0),FLOAT(-1.0),FLOAT(-1.0),FLOAT(0.0),FLOAT(0.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<438>");
	t_surf->p_AddVertex(FLOAT(-1.0),FLOAT(1.0),FLOAT(-1.0),FLOAT(0.0),FLOAT(0.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<439>");
	t_surf->p_AddVertex(FLOAT(1.0),FLOAT(1.0),FLOAT(-1.0),FLOAT(0.0),FLOAT(0.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<440>");
	t_surf->p_AddVertex(FLOAT(1.0),FLOAT(-1.0),FLOAT(-1.0),FLOAT(0.0),FLOAT(0.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<442>");
	t_surf->p_AddVertex(FLOAT(-1.0),FLOAT(-1.0),FLOAT(1.0),FLOAT(0.0),FLOAT(0.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<443>");
	t_surf->p_AddVertex(FLOAT(-1.0),FLOAT(1.0),FLOAT(1.0),FLOAT(0.0),FLOAT(0.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<444>");
	t_surf->p_AddVertex(FLOAT(1.0),FLOAT(1.0),FLOAT(1.0),FLOAT(0.0),FLOAT(0.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<445>");
	t_surf->p_AddVertex(FLOAT(1.0),FLOAT(-1.0),FLOAT(1.0),FLOAT(0.0),FLOAT(0.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<447>");
	t_surf->p_AddVertex(FLOAT(-1.0),FLOAT(-1.0),FLOAT(1.0),FLOAT(0.0),FLOAT(0.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<448>");
	t_surf->p_AddVertex(FLOAT(-1.0),FLOAT(1.0),FLOAT(1.0),FLOAT(0.0),FLOAT(0.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<449>");
	t_surf->p_AddVertex(FLOAT(1.0),FLOAT(1.0),FLOAT(1.0),FLOAT(0.0),FLOAT(0.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<450>");
	t_surf->p_AddVertex(FLOAT(1.0),FLOAT(-1.0),FLOAT(1.0),FLOAT(0.0),FLOAT(0.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<452>");
	t_surf->p_AddVertex(FLOAT(-1.0),FLOAT(-1.0),FLOAT(-1.0),FLOAT(0.0),FLOAT(0.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<453>");
	t_surf->p_AddVertex(FLOAT(-1.0),FLOAT(1.0),FLOAT(-1.0),FLOAT(0.0),FLOAT(0.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<454>");
	t_surf->p_AddVertex(FLOAT(1.0),FLOAT(1.0),FLOAT(-1.0),FLOAT(0.0),FLOAT(0.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<455>");
	t_surf->p_AddVertex(FLOAT(1.0),FLOAT(-1.0),FLOAT(-1.0),FLOAT(0.0),FLOAT(0.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<457>");
	t_surf->p_AddVertex(FLOAT(-1.0),FLOAT(-1.0),FLOAT(1.0),FLOAT(0.0),FLOAT(0.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<458>");
	t_surf->p_AddVertex(FLOAT(-1.0),FLOAT(1.0),FLOAT(1.0),FLOAT(0.0),FLOAT(0.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<459>");
	t_surf->p_AddVertex(FLOAT(1.0),FLOAT(1.0),FLOAT(1.0),FLOAT(0.0),FLOAT(0.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<460>");
	t_surf->p_AddVertex(FLOAT(1.0),FLOAT(-1.0),FLOAT(1.0),FLOAT(0.0),FLOAT(0.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<462>");
	t_surf->p_AddVertex(FLOAT(-1.0),FLOAT(-1.0),FLOAT(-1.0),FLOAT(0.0),FLOAT(0.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<463>");
	t_surf->p_AddVertex(FLOAT(-1.0),FLOAT(1.0),FLOAT(-1.0),FLOAT(0.0),FLOAT(0.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<464>");
	t_surf->p_AddVertex(FLOAT(1.0),FLOAT(1.0),FLOAT(-1.0),FLOAT(0.0),FLOAT(0.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<465>");
	t_surf->p_AddVertex(FLOAT(1.0),FLOAT(-1.0),FLOAT(-1.0),FLOAT(0.0),FLOAT(0.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<467>");
	t_surf->p_VertexNormal(0,FLOAT(0.0),FLOAT(0.0),FLOAT(-1.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<468>");
	t_surf->p_VertexNormal(1,FLOAT(0.0),FLOAT(0.0),FLOAT(-1.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<469>");
	t_surf->p_VertexNormal(2,FLOAT(0.0),FLOAT(0.0),FLOAT(-1.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<470>");
	t_surf->p_VertexNormal(3,FLOAT(0.0),FLOAT(0.0),FLOAT(-1.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<472>");
	t_surf->p_VertexNormal(4,FLOAT(0.0),FLOAT(0.0),FLOAT(1.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<473>");
	t_surf->p_VertexNormal(5,FLOAT(0.0),FLOAT(0.0),FLOAT(1.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<474>");
	t_surf->p_VertexNormal(6,FLOAT(0.0),FLOAT(0.0),FLOAT(1.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<475>");
	t_surf->p_VertexNormal(7,FLOAT(0.0),FLOAT(0.0),FLOAT(1.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<477>");
	t_surf->p_VertexNormal(8,FLOAT(0.0),FLOAT(-1.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<478>");
	t_surf->p_VertexNormal(9,FLOAT(0.0),FLOAT(1.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<479>");
	t_surf->p_VertexNormal(10,FLOAT(0.0),FLOAT(1.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<480>");
	t_surf->p_VertexNormal(11,FLOAT(0.0),FLOAT(-1.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<482>");
	t_surf->p_VertexNormal(12,FLOAT(0.0),FLOAT(-1.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<483>");
	t_surf->p_VertexNormal(13,FLOAT(0.0),FLOAT(1.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<484>");
	t_surf->p_VertexNormal(14,FLOAT(0.0),FLOAT(1.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<485>");
	t_surf->p_VertexNormal(15,FLOAT(0.0),FLOAT(-1.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<487>");
	t_surf->p_VertexNormal(16,FLOAT(-1.0),FLOAT(0.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<488>");
	t_surf->p_VertexNormal(17,FLOAT(-1.0),FLOAT(0.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<489>");
	t_surf->p_VertexNormal(18,FLOAT(1.0),FLOAT(0.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<490>");
	t_surf->p_VertexNormal(19,FLOAT(1.0),FLOAT(0.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<492>");
	t_surf->p_VertexNormal(20,FLOAT(-1.0),FLOAT(0.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<493>");
	t_surf->p_VertexNormal(21,FLOAT(-1.0),FLOAT(0.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<494>");
	t_surf->p_VertexNormal(22,FLOAT(1.0),FLOAT(0.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<495>");
	t_surf->p_VertexNormal(23,FLOAT(1.0),FLOAT(0.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<497>");
	t_surf->p_VertexTexCoords(0,FLOAT(0.0),FLOAT(1.0),FLOAT(0.0),0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<498>");
	t_surf->p_VertexTexCoords(1,FLOAT(0.0),FLOAT(0.0),FLOAT(0.0),0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<499>");
	t_surf->p_VertexTexCoords(2,FLOAT(1.0),FLOAT(0.0),FLOAT(0.0),0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<500>");
	t_surf->p_VertexTexCoords(3,FLOAT(1.0),FLOAT(1.0),FLOAT(0.0),0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<502>");
	t_surf->p_VertexTexCoords(4,FLOAT(1.0),FLOAT(1.0),FLOAT(0.0),0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<503>");
	t_surf->p_VertexTexCoords(5,FLOAT(1.0),FLOAT(0.0),FLOAT(0.0),0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<504>");
	t_surf->p_VertexTexCoords(6,FLOAT(0.0),FLOAT(0.0),FLOAT(0.0),0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<505>");
	t_surf->p_VertexTexCoords(7,FLOAT(0.0),FLOAT(1.0),FLOAT(0.0),0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<507>");
	t_surf->p_VertexTexCoords(8,FLOAT(0.0),FLOAT(1.0),FLOAT(0.0),0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<508>");
	t_surf->p_VertexTexCoords(9,FLOAT(0.0),FLOAT(0.0),FLOAT(0.0),0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<509>");
	t_surf->p_VertexTexCoords(10,FLOAT(1.0),FLOAT(0.0),FLOAT(0.0),0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<510>");
	t_surf->p_VertexTexCoords(11,FLOAT(1.0),FLOAT(1.0),FLOAT(0.0),0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<512>");
	t_surf->p_VertexTexCoords(12,FLOAT(0.0),FLOAT(0.0),FLOAT(0.0),0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<513>");
	t_surf->p_VertexTexCoords(13,FLOAT(0.0),FLOAT(1.0),FLOAT(0.0),0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<514>");
	t_surf->p_VertexTexCoords(14,FLOAT(1.0),FLOAT(1.0),FLOAT(0.0),0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<515>");
	t_surf->p_VertexTexCoords(15,FLOAT(1.0),FLOAT(0.0),FLOAT(0.0),0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<517>");
	t_surf->p_VertexTexCoords(16,FLOAT(0.0),FLOAT(1.0),FLOAT(0.0),0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<518>");
	t_surf->p_VertexTexCoords(17,FLOAT(0.0),FLOAT(0.0),FLOAT(0.0),0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<519>");
	t_surf->p_VertexTexCoords(18,FLOAT(1.0),FLOAT(0.0),FLOAT(0.0),0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<520>");
	t_surf->p_VertexTexCoords(19,FLOAT(1.0),FLOAT(1.0),FLOAT(0.0),0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<522>");
	t_surf->p_VertexTexCoords(20,FLOAT(1.0),FLOAT(1.0),FLOAT(0.0),0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<523>");
	t_surf->p_VertexTexCoords(21,FLOAT(1.0),FLOAT(0.0),FLOAT(0.0),0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<524>");
	t_surf->p_VertexTexCoords(22,FLOAT(0.0),FLOAT(0.0),FLOAT(0.0),0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<525>");
	t_surf->p_VertexTexCoords(23,FLOAT(0.0),FLOAT(1.0),FLOAT(0.0),0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<527>");
	t_surf->p_VertexTexCoords(0,FLOAT(0.0),FLOAT(1.0),FLOAT(0.0),1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<528>");
	t_surf->p_VertexTexCoords(1,FLOAT(0.0),FLOAT(0.0),FLOAT(0.0),1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<529>");
	t_surf->p_VertexTexCoords(2,FLOAT(1.0),FLOAT(0.0),FLOAT(0.0),1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<530>");
	t_surf->p_VertexTexCoords(3,FLOAT(1.0),FLOAT(1.0),FLOAT(0.0),1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<532>");
	t_surf->p_VertexTexCoords(4,FLOAT(1.0),FLOAT(1.0),FLOAT(0.0),1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<533>");
	t_surf->p_VertexTexCoords(5,FLOAT(1.0),FLOAT(0.0),FLOAT(0.0),1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<534>");
	t_surf->p_VertexTexCoords(6,FLOAT(0.0),FLOAT(0.0),FLOAT(0.0),1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<535>");
	t_surf->p_VertexTexCoords(7,FLOAT(0.0),FLOAT(1.0),FLOAT(0.0),1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<537>");
	t_surf->p_VertexTexCoords(8,FLOAT(0.0),FLOAT(1.0),FLOAT(0.0),1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<538>");
	t_surf->p_VertexTexCoords(9,FLOAT(0.0),FLOAT(0.0),FLOAT(0.0),1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<539>");
	t_surf->p_VertexTexCoords(10,FLOAT(1.0),FLOAT(0.0),FLOAT(0.0),1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<540>");
	t_surf->p_VertexTexCoords(11,FLOAT(1.0),FLOAT(1.0),FLOAT(0.0),1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<542>");
	t_surf->p_VertexTexCoords(12,FLOAT(0.0),FLOAT(0.0),FLOAT(0.0),1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<543>");
	t_surf->p_VertexTexCoords(13,FLOAT(0.0),FLOAT(1.0),FLOAT(0.0),1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<544>");
	t_surf->p_VertexTexCoords(14,FLOAT(1.0),FLOAT(1.0),FLOAT(0.0),1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<545>");
	t_surf->p_VertexTexCoords(15,FLOAT(1.0),FLOAT(0.0),FLOAT(0.0),1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<547>");
	t_surf->p_VertexTexCoords(16,FLOAT(0.0),FLOAT(1.0),FLOAT(0.0),1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<548>");
	t_surf->p_VertexTexCoords(17,FLOAT(0.0),FLOAT(0.0),FLOAT(0.0),1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<549>");
	t_surf->p_VertexTexCoords(18,FLOAT(1.0),FLOAT(0.0),FLOAT(0.0),1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<550>");
	t_surf->p_VertexTexCoords(19,FLOAT(1.0),FLOAT(1.0),FLOAT(0.0),1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<552>");
	t_surf->p_VertexTexCoords(20,FLOAT(1.0),FLOAT(1.0),FLOAT(0.0),1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<553>");
	t_surf->p_VertexTexCoords(21,FLOAT(1.0),FLOAT(0.0),FLOAT(0.0),1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<554>");
	t_surf->p_VertexTexCoords(22,FLOAT(0.0),FLOAT(0.0),FLOAT(0.0),1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<555>");
	t_surf->p_VertexTexCoords(23,FLOAT(0.0),FLOAT(1.0),FLOAT(0.0),1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<557>");
	t_surf->p_AddTriangle(0,1,2);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<558>");
	t_surf->p_AddTriangle(0,2,3);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<559>");
	t_surf->p_AddTriangle(6,5,4);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<560>");
	t_surf->p_AddTriangle(7,6,4);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<561>");
	t_surf->p_AddTriangle(14,13,9);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<562>");
	t_surf->p_AddTriangle(10,14,9);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<563>");
	t_surf->p_AddTriangle(8,12,15);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<564>");
	t_surf->p_AddTriangle(8,15,11);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<565>");
	t_surf->p_AddTriangle(22,18,19);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<566>");
	t_surf->p_AddTriangle(23,22,19);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<567>");
	t_surf->p_AddTriangle(16,17,21);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<568>");
	t_surf->p_AddTriangle(16,21,20);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<570>");
	t_surf->p_CropSurfaceBuffers();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<572>");
	t_mesh->m_classname=String(L"MeshCube",8);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<574>");
	return t_mesh;
}
int c_TMesh::p_Draw(Float t_x,Float t_y,bool t_no_scaling){
	DBG_ENTER("TMesh.Draw")
	c_TMesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_x,"x")
	DBG_LOCAL(t_y,"y")
	DBG_LOCAL(t_no_scaling,"no_scaling")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<2067>");
	c_TRender::m_draw_list->p_AddLast3(this);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<2069>");
	Float t_w=FLOAT(.0);
	DBG_LOCAL(t_w,"w")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<2070>");
	Float t_h=FLOAT(.0);
	DBG_LOCAL(t_h,"h")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<2071>");
	if(m_parent!=0){
		DBG_BLOCK();
		p_EntityParent(0,true);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<2073>");
	p_PositionEntity(t_x,t_y,FLOAT(1.99999),0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<2076>");
	c_TSprite* t_spr=dynamic_cast<c_TSprite*>(this);
	DBG_LOCAL(t_spr,"spr")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<2077>");
	if(!t_no_scaling && t_spr!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<2078>");
		t_spr->m_pixel_scale.At(0)=FLOAT(1.0);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<2079>");
		t_spr->m_pixel_scale.At(1)=FLOAT(1.0);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<2081>");
		if((dynamic_cast<c_TText*>(this))!=0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<2083>");
			Float t_scx=Float(int(dynamic_cast<c_TText*>(this)->m_char_pixels*dynamic_cast<c_TText*>(this)->m_pixel_ratio+FLOAT(1.5)));
			DBG_LOCAL(t_scx,"scx")
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<2084>");
			t_spr->m_pixel_scale.At(0)=t_scx;
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<2085>");
			t_spr->m_pixel_scale.At(1)=t_scx;
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<2088>");
			Float t_scx2=Float(this->m_brush->p_GetTexture(0)->m_width)*FLOAT(0.5);
			DBG_LOCAL(t_scx2,"scx")
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<2089>");
			Float t_scy=Float(this->m_brush->p_GetTexture(0)->m_height)*FLOAT(0.5);
			DBG_LOCAL(t_scy,"scy")
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<2091>");
			t_spr->m_pixel_scale.At(0)=t_scx2;
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<2092>");
			t_spr->m_pixel_scale.At(1)=t_scy;
		}
	}
	return 0;
}
c_TSurface* c_TMesh::p_GetAnimSurface(c_TSurface* t_surf){
	DBG_ENTER("TMesh.GetAnimSurface")
	c_TMesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_surf,"surf")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1959>");
	return m_anim_surf.At(t_surf->m_surf_id);
}
c_TSurface* c_TMesh::p_GetAnimSurface2(int t_s){
	DBG_ENTER("TMesh.GetAnimSurface")
	c_TMesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_s,"s")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1965>");
	if(t_s<0 || t_s>m_anim_surf.Length()){
		DBG_BLOCK();
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<1966>");
	c_TSurface* t_=m_anim_surf.At(t_s-1);
	return t_;
}
void c_TMesh::p_UpdateVertexAnimFrame(c_TSurface* t_surf,c_TSurface* t_orig_surf){
	DBG_ENTER("TMesh.UpdateVertexAnimFrame")
	c_TMesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_surf,"surf")
	DBG_LOCAL(t_orig_surf,"orig_surf")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<2159>");
	if(!((t_surf)!=0)){
		DBG_BLOCK();
		return;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<2161>");
	t_surf->m_anim_frame=this->m_anim_surf_frame.At(t_orig_surf->m_surf_id);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tmesh.monkey<2164>");
	t_surf->m_reset_vbo=t_surf->m_reset_vbo|1;
}
void c_TMesh::mark(){
	c_TEntity::mark();
	gc_mark_q(m_surf_list);
	gc_mark_q(m_anim_surf);
	gc_mark_q(m_anim_surf_frame);
	gc_mark_q(m_col_tree);
	gc_mark_q(m_vec_temp);
	gc_mark_q(m_vecbounds);
}
String c_TMesh::debug(){
	String t="(TMesh)\n";
	t=c_TEntity::debug()+t;
	t+=dbg_decl("min_x",&m_min_x);
	t+=dbg_decl("min_y",&m_min_y);
	t+=dbg_decl("min_z",&m_min_z);
	t+=dbg_decl("max_x",&m_max_x);
	t+=dbg_decl("max_y",&m_max_y);
	t+=dbg_decl("max_z",&m_max_z);
	t+=dbg_decl("no_surfs",&m_no_surfs);
	t+=dbg_decl("surf_list",&m_surf_list);
	t+=dbg_decl("total_tris",&m_total_tris);
	t+=dbg_decl("anim_surf",&m_anim_surf);
	t+=dbg_decl("anim_surf_frame",&m_anim_surf_frame);
	t+=dbg_decl("col_tree",&m_col_tree);
	t+=dbg_decl("reset_bounds",&m_reset_bounds);
	t+=dbg_decl("center_x",&m_center_x);
	t+=dbg_decl("center_y",&m_center_y);
	t+=dbg_decl("center_z",&m_center_z);
	t+=dbg_decl("vecbounds",&m_vecbounds);
	t+=dbg_decl("is_sprite",&m_is_sprite);
	t+=dbg_decl("culled",&m_culled);
	t+=dbg_decl("distance_nearplane",&m_distance_nearplane);
	t+=dbg_decl("wireframe",&m_wireframe);
	t+=dbg_decl("vec_temp",&m_vec_temp);
	return t;
}
c_Matrix::c_Matrix(){
	m_grid=Array<Array<Float > >(4);
}
c_Matrix* c_Matrix::m_new(){
	DBG_ENTER("Matrix.new")
	c_Matrix *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<29>");
	Float t_[]={FLOAT(0.0),FLOAT(0.0),FLOAT(0.0),FLOAT(0.0)};
	Float t_2[]={FLOAT(0.0),FLOAT(0.0),FLOAT(0.0),FLOAT(0.0)};
	Float t_3[]={FLOAT(0.0),FLOAT(0.0),FLOAT(0.0),FLOAT(0.0)};
	Float t_4[]={FLOAT(0.0),FLOAT(0.0),FLOAT(0.0),FLOAT(0.0)};
	Array<Float > t_5[]={Array<Float >(t_,4),Array<Float >(t_2,4),Array<Float >(t_3,4),Array<Float >(t_4,4)};
	gc_assign(m_grid,Array<Array<Float > >(t_5,4));
	return this;
}
c_Matrix* c_Matrix::m_new2(c_Vector* t_a,c_Vector* t_b,c_Vector* t_c){
	DBG_ENTER("Matrix.new")
	c_Matrix *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_a,"a")
	DBG_LOCAL(t_b,"b")
	DBG_LOCAL(t_c,"c")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<36>");
	Float t_[]={t_a->m_x,t_a->m_y,t_a->m_z,FLOAT(0.0)};
	gc_assign(m_grid.At(0),Array<Float >(t_,4));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<37>");
	Float t_2[]={t_b->m_x,t_b->m_y,t_b->m_z,FLOAT(0.0)};
	gc_assign(m_grid.At(1),Array<Float >(t_2,4));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<38>");
	Float t_3[]={t_c->m_x,t_c->m_y,t_c->m_z,FLOAT(0.0)};
	gc_assign(m_grid.At(2),Array<Float >(t_3,4));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<39>");
	Float t_4[]={FLOAT(0.0),FLOAT(0.0),FLOAT(0.0),FLOAT(1.0)};
	gc_assign(m_grid.At(3),Array<Float >(t_4,4));
	return this;
}
void c_Matrix::p_LoadIdentity(){
	DBG_ENTER("Matrix.LoadIdentity")
	c_Matrix *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<46>");
	m_grid.At(0).At(0)=FLOAT(1.0);
	m_grid.At(0).At(1)=FLOAT(0.0);
	m_grid.At(0).At(2)=FLOAT(0.0);
	m_grid.At(0).At(3)=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<47>");
	m_grid.At(1).At(0)=FLOAT(0.0);
	m_grid.At(1).At(1)=FLOAT(1.0);
	m_grid.At(1).At(2)=FLOAT(0.0);
	m_grid.At(1).At(3)=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<48>");
	m_grid.At(2).At(0)=FLOAT(0.0);
	m_grid.At(2).At(1)=FLOAT(0.0);
	m_grid.At(2).At(2)=FLOAT(1.0);
	m_grid.At(2).At(3)=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<49>");
	m_grid.At(3).At(0)=FLOAT(0.0);
	m_grid.At(3).At(1)=FLOAT(0.0);
	m_grid.At(3).At(2)=FLOAT(0.0);
	m_grid.At(3).At(3)=FLOAT(1.0);
}
void c_Matrix::p_Overwrite(c_Matrix* t_mat){
	DBG_ENTER("Matrix.Overwrite")
	c_Matrix *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_mat,"mat")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<87>");
	m_grid.At(0).At(0)=t_mat->m_grid.At(0).At(0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<88>");
	m_grid.At(1).At(0)=t_mat->m_grid.At(1).At(0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<89>");
	m_grid.At(2).At(0)=t_mat->m_grid.At(2).At(0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<90>");
	m_grid.At(3).At(0)=t_mat->m_grid.At(3).At(0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<91>");
	m_grid.At(0).At(1)=t_mat->m_grid.At(0).At(1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<92>");
	m_grid.At(1).At(1)=t_mat->m_grid.At(1).At(1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<93>");
	m_grid.At(2).At(1)=t_mat->m_grid.At(2).At(1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<94>");
	m_grid.At(3).At(1)=t_mat->m_grid.At(3).At(1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<95>");
	m_grid.At(0).At(2)=t_mat->m_grid.At(0).At(2);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<96>");
	m_grid.At(1).At(2)=t_mat->m_grid.At(1).At(2);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<97>");
	m_grid.At(2).At(2)=t_mat->m_grid.At(2).At(2);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<98>");
	m_grid.At(3).At(2)=t_mat->m_grid.At(3).At(2);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<100>");
	m_grid.At(0).At(3)=t_mat->m_grid.At(0).At(3);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<101>");
	m_grid.At(1).At(3)=t_mat->m_grid.At(1).At(3);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<102>");
	m_grid.At(2).At(3)=t_mat->m_grid.At(2).At(3);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<103>");
	m_grid.At(3).At(3)=t_mat->m_grid.At(3).At(3);
}
void c_Matrix::p_Translate(Float t_x,Float t_y,Float t_z){
	DBG_ENTER("Matrix.Translate")
	c_Matrix *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_x,"x")
	DBG_LOCAL(t_y,"y")
	DBG_LOCAL(t_z,"z")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<314>");
	m_grid.At(3).At(0)=m_grid.At(0).At(0)*t_x+m_grid.At(1).At(0)*t_y+m_grid.At(2).At(0)*t_z+m_grid.At(3).At(0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<315>");
	m_grid.At(3).At(1)=m_grid.At(0).At(1)*t_x+m_grid.At(1).At(1)*t_y+m_grid.At(2).At(1)*t_z+m_grid.At(3).At(1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<316>");
	m_grid.At(3).At(2)=m_grid.At(0).At(2)*t_x+m_grid.At(1).At(2)*t_y+m_grid.At(2).At(2)*t_z+m_grid.At(3).At(2);
}
void c_Matrix::p_Rotate(Float t_rx,Float t_ry,Float t_rz){
	DBG_ENTER("Matrix.Rotate")
	c_Matrix *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_rx,"rx")
	DBG_LOCAL(t_ry,"ry")
	DBG_LOCAL(t_rz,"rz")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<454>");
	Float t_cos_ang=FLOAT(.0);
	Float t_sin_ang=FLOAT(.0);
	Float t_m20=FLOAT(.0);
	Float t_m21=FLOAT(.0);
	Float t_m22=FLOAT(.0);
	Float t_m00=FLOAT(.0);
	Float t_m01=FLOAT(.0);
	Float t_m02=FLOAT(.0);
	Float t_r1=FLOAT(.0);
	Float t_r2=FLOAT(.0);
	Float t_r3=FLOAT(.0);
	DBG_LOCAL(t_cos_ang,"cos_ang")
	DBG_LOCAL(t_sin_ang,"sin_ang")
	DBG_LOCAL(t_m20,"m20")
	DBG_LOCAL(t_m21,"m21")
	DBG_LOCAL(t_m22,"m22")
	DBG_LOCAL(t_m00,"m00")
	DBG_LOCAL(t_m01,"m01")
	DBG_LOCAL(t_m02,"m02")
	DBG_LOCAL(t_r1,"r1")
	DBG_LOCAL(t_r2,"r2")
	DBG_LOCAL(t_r3,"r3")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<458>");
	t_cos_ang=(Float)cos((t_ry)*D2R);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<459>");
	t_sin_ang=(Float)sin((t_ry)*D2R);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<461>");
	t_m00=m_grid.At(0).At(0)*t_cos_ang+m_grid.At(2).At(0)*-t_sin_ang;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<462>");
	t_m01=m_grid.At(0).At(1)*t_cos_ang+m_grid.At(2).At(1)*-t_sin_ang;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<463>");
	t_m02=m_grid.At(0).At(2)*t_cos_ang+m_grid.At(2).At(2)*-t_sin_ang;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<465>");
	t_m20=m_grid.At(0).At(0)*t_sin_ang+m_grid.At(2).At(0)*t_cos_ang;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<466>");
	t_m21=m_grid.At(0).At(1)*t_sin_ang+m_grid.At(2).At(1)*t_cos_ang;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<467>");
	t_m22=m_grid.At(0).At(2)*t_sin_ang+m_grid.At(2).At(2)*t_cos_ang;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<471>");
	t_cos_ang=(Float)cos((t_rx)*D2R);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<472>");
	t_sin_ang=(Float)sin((t_rx)*D2R);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<474>");
	Float t_m10=m_grid.At(1).At(0)*t_cos_ang+t_m20*t_sin_ang;
	DBG_LOCAL(t_m10,"m10")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<475>");
	Float t_m11=m_grid.At(1).At(1)*t_cos_ang+t_m21*t_sin_ang;
	DBG_LOCAL(t_m11,"m11")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<476>");
	Float t_m12=m_grid.At(1).At(2)*t_cos_ang+t_m22*t_sin_ang;
	DBG_LOCAL(t_m12,"m12")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<478>");
	m_grid.At(2).At(0)=m_grid.At(1).At(0)*-t_sin_ang+t_m20*t_cos_ang;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<479>");
	m_grid.At(2).At(1)=m_grid.At(1).At(1)*-t_sin_ang+t_m21*t_cos_ang;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<480>");
	m_grid.At(2).At(2)=m_grid.At(1).At(2)*-t_sin_ang+t_m22*t_cos_ang;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<484>");
	t_cos_ang=(Float)cos((t_rz)*D2R);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<485>");
	t_sin_ang=(Float)sin((t_rz)*D2R);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<487>");
	m_grid.At(0).At(0)=t_m00*t_cos_ang+t_m10*t_sin_ang;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<488>");
	m_grid.At(0).At(1)=t_m01*t_cos_ang+t_m11*t_sin_ang;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<489>");
	m_grid.At(0).At(2)=t_m02*t_cos_ang+t_m12*t_sin_ang;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<491>");
	m_grid.At(1).At(0)=t_m00*-t_sin_ang+t_m10*t_cos_ang;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<492>");
	m_grid.At(1).At(1)=t_m01*-t_sin_ang+t_m11*t_cos_ang;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<493>");
	m_grid.At(1).At(2)=t_m02*-t_sin_ang+t_m12*t_cos_ang;
}
void c_Matrix::p_Scale(Float t_sx,Float t_sy,Float t_sz){
	DBG_ENTER("Matrix.Scale")
	c_Matrix *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_sx,"sx")
	DBG_LOCAL(t_sy,"sy")
	DBG_LOCAL(t_sz,"sz")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<359>");
	if(t_sx==FLOAT(1.0) && t_sy==FLOAT(1.0) && t_sz==FLOAT(1.0)){
		DBG_BLOCK();
		return;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<361>");
	m_grid.At(0).At(0)=m_grid.At(0).At(0)*t_sx;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<362>");
	m_grid.At(0).At(1)=m_grid.At(0).At(1)*t_sx;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<363>");
	m_grid.At(0).At(2)=m_grid.At(0).At(2)*t_sx;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<365>");
	m_grid.At(1).At(0)=m_grid.At(1).At(0)*t_sy;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<366>");
	m_grid.At(1).At(1)=m_grid.At(1).At(1)*t_sy;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<367>");
	m_grid.At(1).At(2)=m_grid.At(1).At(2)*t_sy;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<369>");
	m_grid.At(2).At(0)=m_grid.At(2).At(0)*t_sz;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<370>");
	m_grid.At(2).At(1)=m_grid.At(2).At(1)*t_sz;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<371>");
	m_grid.At(2).At(2)=m_grid.At(2).At(2)*t_sz;
}
c_Matrix* c_Matrix::p_Inverse(){
	DBG_ENTER("Matrix.Inverse")
	c_Matrix *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<112>");
	c_Matrix* t_mat=(new c_Matrix)->m_new();
	DBG_LOCAL(t_mat,"mat")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<114>");
	Float t_tx=FLOAT(0.0);
	DBG_LOCAL(t_tx,"tx")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<115>");
	Float t_ty=FLOAT(0.0);
	DBG_LOCAL(t_ty,"ty")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<116>");
	Float t_tz=FLOAT(0.0);
	DBG_LOCAL(t_tz,"tz")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<120>");
	t_mat->m_grid.At(0).At(0)=m_grid.At(0).At(0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<121>");
	t_mat->m_grid.At(1).At(0)=m_grid.At(0).At(1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<122>");
	t_mat->m_grid.At(2).At(0)=m_grid.At(0).At(2);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<124>");
	t_mat->m_grid.At(0).At(1)=m_grid.At(1).At(0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<125>");
	t_mat->m_grid.At(1).At(1)=m_grid.At(1).At(1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<126>");
	t_mat->m_grid.At(2).At(1)=m_grid.At(1).At(2);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<128>");
	t_mat->m_grid.At(0).At(2)=m_grid.At(2).At(0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<129>");
	t_mat->m_grid.At(1).At(2)=m_grid.At(2).At(1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<130>");
	t_mat->m_grid.At(2).At(2)=m_grid.At(2).At(2);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<136>");
	t_mat->m_grid.At(0).At(3)=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<137>");
	t_mat->m_grid.At(1).At(3)=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<138>");
	t_mat->m_grid.At(2).At(3)=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<139>");
	t_mat->m_grid.At(3).At(3)=FLOAT(1.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<142>");
	t_tx=m_grid.At(3).At(0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<143>");
	t_ty=m_grid.At(3).At(1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<144>");
	t_tz=m_grid.At(3).At(2);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<147>");
	t_mat->m_grid.At(3).At(0)=-(m_grid.At(0).At(0)*t_tx+m_grid.At(0).At(1)*t_ty+m_grid.At(0).At(2)*t_tz);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<148>");
	t_mat->m_grid.At(3).At(1)=-(m_grid.At(1).At(0)*t_tx+m_grid.At(1).At(1)*t_ty+m_grid.At(1).At(2)*t_tz);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<149>");
	t_mat->m_grid.At(3).At(2)=-(m_grid.At(2).At(0)*t_tx+m_grid.At(2).At(1)*t_ty+m_grid.At(2).At(2)*t_tz);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<151>");
	return t_mat;
}
void c_Matrix::p_Multiply4(c_Matrix* t_mat){
	DBG_ENTER("Matrix.Multiply4")
	c_Matrix *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_mat,"mat")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<254>");
	Float t_m00=m_grid.At(0).At(0)*t_mat->m_grid.At(0).At(0)+m_grid.At(1).At(0)*t_mat->m_grid.At(0).At(1)+m_grid.At(2).At(0)*t_mat->m_grid.At(0).At(2)+m_grid.At(3).At(0)*t_mat->m_grid.At(0).At(3);
	DBG_LOCAL(t_m00,"m00")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<255>");
	Float t_m01=m_grid.At(0).At(1)*t_mat->m_grid.At(0).At(0)+m_grid.At(1).At(1)*t_mat->m_grid.At(0).At(1)+m_grid.At(2).At(1)*t_mat->m_grid.At(0).At(2)+m_grid.At(3).At(1)*t_mat->m_grid.At(0).At(3);
	DBG_LOCAL(t_m01,"m01")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<256>");
	Float t_m02=m_grid.At(0).At(2)*t_mat->m_grid.At(0).At(0)+m_grid.At(1).At(2)*t_mat->m_grid.At(0).At(1)+m_grid.At(2).At(2)*t_mat->m_grid.At(0).At(2)+m_grid.At(3).At(2)*t_mat->m_grid.At(0).At(3);
	DBG_LOCAL(t_m02,"m02")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<257>");
	Float t_m03=m_grid.At(0).At(3)*t_mat->m_grid.At(0).At(0)+m_grid.At(1).At(3)*t_mat->m_grid.At(0).At(1)+m_grid.At(2).At(3)*t_mat->m_grid.At(0).At(2)+m_grid.At(3).At(3)*t_mat->m_grid.At(0).At(3);
	DBG_LOCAL(t_m03,"m03")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<258>");
	Float t_m10=m_grid.At(0).At(0)*t_mat->m_grid.At(1).At(0)+m_grid.At(1).At(0)*t_mat->m_grid.At(1).At(1)+m_grid.At(2).At(0)*t_mat->m_grid.At(1).At(2)+m_grid.At(3).At(0)*t_mat->m_grid.At(1).At(3);
	DBG_LOCAL(t_m10,"m10")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<259>");
	Float t_m11=m_grid.At(0).At(1)*t_mat->m_grid.At(1).At(0)+m_grid.At(1).At(1)*t_mat->m_grid.At(1).At(1)+m_grid.At(2).At(1)*t_mat->m_grid.At(1).At(2)+m_grid.At(3).At(1)*t_mat->m_grid.At(1).At(3);
	DBG_LOCAL(t_m11,"m11")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<260>");
	Float t_m12=m_grid.At(0).At(2)*t_mat->m_grid.At(1).At(0)+m_grid.At(1).At(2)*t_mat->m_grid.At(1).At(1)+m_grid.At(2).At(2)*t_mat->m_grid.At(1).At(2)+m_grid.At(3).At(2)*t_mat->m_grid.At(1).At(3);
	DBG_LOCAL(t_m12,"m12")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<261>");
	Float t_m13=m_grid.At(0).At(3)*t_mat->m_grid.At(1).At(0)+m_grid.At(1).At(3)*t_mat->m_grid.At(1).At(1)+m_grid.At(2).At(3)*t_mat->m_grid.At(1).At(2)+m_grid.At(3).At(3)*t_mat->m_grid.At(1).At(3);
	DBG_LOCAL(t_m13,"m13")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<262>");
	Float t_m20=m_grid.At(0).At(0)*t_mat->m_grid.At(2).At(0)+m_grid.At(1).At(0)*t_mat->m_grid.At(2).At(1)+m_grid.At(2).At(0)*t_mat->m_grid.At(2).At(2)+m_grid.At(3).At(0)*t_mat->m_grid.At(2).At(3);
	DBG_LOCAL(t_m20,"m20")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<263>");
	Float t_m21=m_grid.At(0).At(1)*t_mat->m_grid.At(2).At(0)+m_grid.At(1).At(1)*t_mat->m_grid.At(2).At(1)+m_grid.At(2).At(1)*t_mat->m_grid.At(2).At(2)+m_grid.At(3).At(1)*t_mat->m_grid.At(2).At(3);
	DBG_LOCAL(t_m21,"m21")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<264>");
	Float t_m22=m_grid.At(0).At(2)*t_mat->m_grid.At(2).At(0)+m_grid.At(1).At(2)*t_mat->m_grid.At(2).At(1)+m_grid.At(2).At(2)*t_mat->m_grid.At(2).At(2)+m_grid.At(3).At(2)*t_mat->m_grid.At(2).At(3);
	DBG_LOCAL(t_m22,"m22")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<265>");
	Float t_m23=m_grid.At(0).At(3)*t_mat->m_grid.At(2).At(0)+m_grid.At(1).At(3)*t_mat->m_grid.At(2).At(1)+m_grid.At(2).At(3)*t_mat->m_grid.At(2).At(2)+m_grid.At(3).At(3)*t_mat->m_grid.At(2).At(3);
	DBG_LOCAL(t_m23,"m23")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<266>");
	Float t_m30=m_grid.At(0).At(0)*t_mat->m_grid.At(3).At(0)+m_grid.At(1).At(0)*t_mat->m_grid.At(3).At(1)+m_grid.At(2).At(0)*t_mat->m_grid.At(3).At(2)+m_grid.At(3).At(0)*t_mat->m_grid.At(3).At(3);
	DBG_LOCAL(t_m30,"m30")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<267>");
	Float t_m31=m_grid.At(0).At(1)*t_mat->m_grid.At(3).At(0)+m_grid.At(1).At(1)*t_mat->m_grid.At(3).At(1)+m_grid.At(2).At(1)*t_mat->m_grid.At(3).At(2)+m_grid.At(3).At(1)*t_mat->m_grid.At(3).At(3);
	DBG_LOCAL(t_m31,"m31")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<268>");
	Float t_m32=m_grid.At(0).At(2)*t_mat->m_grid.At(3).At(0)+m_grid.At(1).At(2)*t_mat->m_grid.At(3).At(1)+m_grid.At(2).At(2)*t_mat->m_grid.At(3).At(2)+m_grid.At(3).At(2)*t_mat->m_grid.At(3).At(3);
	DBG_LOCAL(t_m32,"m32")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<269>");
	Float t_m33=m_grid.At(0).At(3)*t_mat->m_grid.At(3).At(0)+m_grid.At(1).At(3)*t_mat->m_grid.At(3).At(1)+m_grid.At(2).At(3)*t_mat->m_grid.At(3).At(2)+m_grid.At(3).At(3)*t_mat->m_grid.At(3).At(3);
	DBG_LOCAL(t_m33,"m33")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<271>");
	m_grid.At(0).At(0)=t_m00;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<272>");
	m_grid.At(0).At(1)=t_m01;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<273>");
	m_grid.At(0).At(2)=t_m02;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<274>");
	m_grid.At(0).At(3)=t_m03;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<275>");
	m_grid.At(1).At(0)=t_m10;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<276>");
	m_grid.At(1).At(1)=t_m11;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<277>");
	m_grid.At(1).At(2)=t_m12;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<278>");
	m_grid.At(1).At(3)=t_m13;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<279>");
	m_grid.At(2).At(0)=t_m20;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<280>");
	m_grid.At(2).At(1)=t_m21;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<281>");
	m_grid.At(2).At(2)=t_m22;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<282>");
	m_grid.At(2).At(3)=t_m23;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<283>");
	m_grid.At(3).At(0)=t_m30;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<284>");
	m_grid.At(3).At(1)=t_m31;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<285>");
	m_grid.At(3).At(2)=t_m32;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<286>");
	m_grid.At(3).At(3)=t_m33;
}
c_Vector* c_Matrix::p_Multiply42(c_Vector* t_v1){
	DBG_ENTER("Matrix.Multiply4")
	c_Matrix *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_v1,"v1")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<303>");
	c_Vector* t_v2=(new c_Vector)->m_new(FLOAT(0.0),FLOAT(0.0),FLOAT(0.0));
	DBG_LOCAL(t_v2,"v2")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<305>");
	t_v2->m_x=m_grid.At(0).At(0)*t_v1->m_x+m_grid.At(1).At(0)*t_v1->m_y+m_grid.At(2).At(0)*t_v1->m_z+m_grid.At(3).At(0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<306>");
	t_v2->m_y=m_grid.At(0).At(1)*t_v1->m_x+m_grid.At(1).At(1)*t_v1->m_y+m_grid.At(2).At(1)*t_v1->m_z+m_grid.At(3).At(1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<307>");
	t_v2->m_z=m_grid.At(0).At(2)*t_v1->m_x+m_grid.At(1).At(2)*t_v1->m_y+m_grid.At(2).At(2)*t_v1->m_z+m_grid.At(3).At(2);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<309>");
	return t_v2;
}
Array<Float > c_Matrix::p_ToArray(){
	DBG_ENTER("Matrix.ToArray")
	c_Matrix *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<633>");
	Array<Float > t_arr=Array<Float >(16);
	DBG_LOCAL(t_arr,"arr")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<635>");
	t_arr.At(0)=m_grid.At(0).At(0);
	t_arr.At(1)=m_grid.At(0).At(1);
	t_arr.At(2)=m_grid.At(0).At(2);
	t_arr.At(3)=m_grid.At(0).At(3);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<636>");
	t_arr.At(4)=m_grid.At(1).At(0);
	t_arr.At(5)=m_grid.At(1).At(1);
	t_arr.At(6)=m_grid.At(1).At(2);
	t_arr.At(7)=m_grid.At(1).At(3);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<637>");
	t_arr.At(8)=m_grid.At(2).At(0);
	t_arr.At(9)=m_grid.At(2).At(1);
	t_arr.At(10)=m_grid.At(2).At(2);
	t_arr.At(11)=m_grid.At(2).At(3);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<638>");
	t_arr.At(12)=m_grid.At(3).At(0);
	t_arr.At(13)=m_grid.At(3).At(1);
	t_arr.At(14)=m_grid.At(3).At(2);
	t_arr.At(15)=m_grid.At(3).At(3);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<640>");
	return t_arr;
}
void c_Matrix::p_ToArray2(Array<Float > t_arr){
	DBG_ENTER("Matrix.ToArray")
	c_Matrix *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_arr,"arr")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<646>");
	t_arr.At(0)=m_grid.At(0).At(0);
	t_arr.At(1)=m_grid.At(0).At(1);
	t_arr.At(2)=m_grid.At(0).At(2);
	t_arr.At(3)=m_grid.At(0).At(3);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<647>");
	t_arr.At(4)=m_grid.At(1).At(0);
	t_arr.At(5)=m_grid.At(1).At(1);
	t_arr.At(6)=m_grid.At(1).At(2);
	t_arr.At(7)=m_grid.At(1).At(3);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<648>");
	t_arr.At(8)=m_grid.At(2).At(0);
	t_arr.At(9)=m_grid.At(2).At(1);
	t_arr.At(10)=m_grid.At(2).At(2);
	t_arr.At(11)=m_grid.At(2).At(3);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<649>");
	t_arr.At(12)=m_grid.At(3).At(0);
	t_arr.At(13)=m_grid.At(3).At(1);
	t_arr.At(14)=m_grid.At(3).At(2);
	t_arr.At(15)=m_grid.At(3).At(3);
}
Array<Float > c_Matrix::p_TransformPoint(Float t_x,Float t_y,Float t_z,Float t_w){
	DBG_ENTER("Matrix.TransformPoint")
	c_Matrix *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_x,"x")
	DBG_LOCAL(t_y,"y")
	DBG_LOCAL(t_z,"z")
	DBG_LOCAL(t_w,"w")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<596>");
	Float t_p0=FLOAT(.0);
	Float t_p1=FLOAT(.0);
	Float t_p2=FLOAT(.0);
	Float t_p3=FLOAT(.0);
	DBG_LOCAL(t_p0,"p0")
	DBG_LOCAL(t_p1,"p1")
	DBG_LOCAL(t_p2,"p2")
	DBG_LOCAL(t_p3,"p3")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<600>");
	t_p0=m_grid.At(0).At(0)*t_x+m_grid.At(1).At(0)*t_y+m_grid.At(2).At(0)*t_z+m_grid.At(3).At(0)*t_w;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<601>");
	t_p1=m_grid.At(0).At(1)*t_x+m_grid.At(1).At(1)*t_y+m_grid.At(2).At(1)*t_z+m_grid.At(3).At(1)*t_w;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<602>");
	t_p2=m_grid.At(0).At(2)*t_x+m_grid.At(1).At(2)*t_y+m_grid.At(2).At(2)*t_z+m_grid.At(3).At(2)*t_w;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<605>");
	Float t_2[]={t_p0,t_p1,t_p2};
	Array<Float > t_=Array<Float >(t_2,3);
	return t_;
}
c_Matrix* c_Matrix::p_Copy(){
	DBG_ENTER("Matrix.Copy")
	c_Matrix *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<57>");
	c_Matrix* t_mat=(new c_Matrix)->m_new();
	DBG_LOCAL(t_mat,"mat")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<59>");
	t_mat->m_grid.At(0).At(0)=m_grid.At(0).At(0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<60>");
	t_mat->m_grid.At(1).At(0)=m_grid.At(1).At(0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<61>");
	t_mat->m_grid.At(2).At(0)=m_grid.At(2).At(0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<62>");
	t_mat->m_grid.At(3).At(0)=m_grid.At(3).At(0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<64>");
	t_mat->m_grid.At(0).At(1)=m_grid.At(0).At(1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<65>");
	t_mat->m_grid.At(1).At(1)=m_grid.At(1).At(1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<66>");
	t_mat->m_grid.At(2).At(1)=m_grid.At(2).At(1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<67>");
	t_mat->m_grid.At(3).At(1)=m_grid.At(3).At(1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<69>");
	t_mat->m_grid.At(0).At(2)=m_grid.At(0).At(2);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<70>");
	t_mat->m_grid.At(1).At(2)=m_grid.At(1).At(2);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<71>");
	t_mat->m_grid.At(2).At(2)=m_grid.At(2).At(2);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<72>");
	t_mat->m_grid.At(3).At(2)=m_grid.At(3).At(2);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<74>");
	t_mat->m_grid.At(0).At(3)=m_grid.At(0).At(3);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<75>");
	t_mat->m_grid.At(1).At(3)=m_grid.At(1).At(3);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<76>");
	t_mat->m_grid.At(2).At(3)=m_grid.At(2).At(3);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<77>");
	t_mat->m_grid.At(3).At(3)=m_grid.At(3).At(3);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<79>");
	return t_mat;
}
void c_Matrix::p_Multiply(c_Matrix* t_mat){
	DBG_ENTER("Matrix.Multiply")
	c_Matrix *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_mat,"mat")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<215>");
	Float t_m00=m_grid.At(0).At(0)*t_mat->m_grid.At(0).At(0)+m_grid.At(1).At(0)*t_mat->m_grid.At(0).At(1)+m_grid.At(2).At(0)*t_mat->m_grid.At(0).At(2)+m_grid.At(3).At(0)*t_mat->m_grid.At(0).At(3);
	DBG_LOCAL(t_m00,"m00")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<216>");
	Float t_m01=m_grid.At(0).At(1)*t_mat->m_grid.At(0).At(0)+m_grid.At(1).At(1)*t_mat->m_grid.At(0).At(1)+m_grid.At(2).At(1)*t_mat->m_grid.At(0).At(2)+m_grid.At(3).At(1)*t_mat->m_grid.At(0).At(3);
	DBG_LOCAL(t_m01,"m01")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<217>");
	Float t_m02=m_grid.At(0).At(2)*t_mat->m_grid.At(0).At(0)+m_grid.At(1).At(2)*t_mat->m_grid.At(0).At(1)+m_grid.At(2).At(2)*t_mat->m_grid.At(0).At(2)+m_grid.At(3).At(2)*t_mat->m_grid.At(0).At(3);
	DBG_LOCAL(t_m02,"m02")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<219>");
	Float t_m10=m_grid.At(0).At(0)*t_mat->m_grid.At(1).At(0)+m_grid.At(1).At(0)*t_mat->m_grid.At(1).At(1)+m_grid.At(2).At(0)*t_mat->m_grid.At(1).At(2)+m_grid.At(3).At(0)*t_mat->m_grid.At(1).At(3);
	DBG_LOCAL(t_m10,"m10")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<220>");
	Float t_m11=m_grid.At(0).At(1)*t_mat->m_grid.At(1).At(0)+m_grid.At(1).At(1)*t_mat->m_grid.At(1).At(1)+m_grid.At(2).At(1)*t_mat->m_grid.At(1).At(2)+m_grid.At(3).At(1)*t_mat->m_grid.At(1).At(3);
	DBG_LOCAL(t_m11,"m11")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<221>");
	Float t_m12=m_grid.At(0).At(2)*t_mat->m_grid.At(1).At(0)+m_grid.At(1).At(2)*t_mat->m_grid.At(1).At(1)+m_grid.At(2).At(2)*t_mat->m_grid.At(1).At(2)+m_grid.At(3).At(2)*t_mat->m_grid.At(1).At(3);
	DBG_LOCAL(t_m12,"m12")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<223>");
	Float t_m20=m_grid.At(0).At(0)*t_mat->m_grid.At(2).At(0)+m_grid.At(1).At(0)*t_mat->m_grid.At(2).At(1)+m_grid.At(2).At(0)*t_mat->m_grid.At(2).At(2)+m_grid.At(3).At(0)*t_mat->m_grid.At(2).At(3);
	DBG_LOCAL(t_m20,"m20")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<224>");
	Float t_m21=m_grid.At(0).At(1)*t_mat->m_grid.At(2).At(0)+m_grid.At(1).At(1)*t_mat->m_grid.At(2).At(1)+m_grid.At(2).At(1)*t_mat->m_grid.At(2).At(2)+m_grid.At(3).At(1)*t_mat->m_grid.At(2).At(3);
	DBG_LOCAL(t_m21,"m21")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<225>");
	Float t_m22=m_grid.At(0).At(2)*t_mat->m_grid.At(2).At(0)+m_grid.At(1).At(2)*t_mat->m_grid.At(2).At(1)+m_grid.At(2).At(2)*t_mat->m_grid.At(2).At(2)+m_grid.At(3).At(2)*t_mat->m_grid.At(2).At(3);
	DBG_LOCAL(t_m22,"m22")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<227>");
	Float t_m30=m_grid.At(0).At(0)*t_mat->m_grid.At(3).At(0)+m_grid.At(1).At(0)*t_mat->m_grid.At(3).At(1)+m_grid.At(2).At(0)*t_mat->m_grid.At(3).At(2)+m_grid.At(3).At(0)*t_mat->m_grid.At(3).At(3);
	DBG_LOCAL(t_m30,"m30")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<228>");
	Float t_m31=m_grid.At(0).At(1)*t_mat->m_grid.At(3).At(0)+m_grid.At(1).At(1)*t_mat->m_grid.At(3).At(1)+m_grid.At(2).At(1)*t_mat->m_grid.At(3).At(2)+m_grid.At(3).At(1)*t_mat->m_grid.At(3).At(3);
	DBG_LOCAL(t_m31,"m31")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<229>");
	Float t_m32=m_grid.At(0).At(2)*t_mat->m_grid.At(3).At(0)+m_grid.At(1).At(2)*t_mat->m_grid.At(3).At(1)+m_grid.At(2).At(2)*t_mat->m_grid.At(3).At(2)+m_grid.At(3).At(2)*t_mat->m_grid.At(3).At(3);
	DBG_LOCAL(t_m32,"m32")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<232>");
	m_grid.At(0).At(0)=t_m00;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<233>");
	m_grid.At(0).At(1)=t_m01;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<234>");
	m_grid.At(0).At(2)=t_m02;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<236>");
	m_grid.At(1).At(0)=t_m10;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<237>");
	m_grid.At(1).At(1)=t_m11;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<238>");
	m_grid.At(1).At(2)=t_m12;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<240>");
	m_grid.At(2).At(0)=t_m20;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<241>");
	m_grid.At(2).At(1)=t_m21;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<242>");
	m_grid.At(2).At(2)=t_m22;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<244>");
	m_grid.At(3).At(0)=t_m30;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<245>");
	m_grid.At(3).At(1)=t_m31;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<246>");
	m_grid.At(3).At(2)=t_m32;
}
c_Vector* c_Matrix::p_Multiply2(c_Vector* t_v1){
	DBG_ENTER("Matrix.Multiply")
	c_Matrix *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_v1,"v1")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<292>");
	c_Vector* t_v2=(new c_Vector)->m_new(FLOAT(0.0),FLOAT(0.0),FLOAT(0.0));
	DBG_LOCAL(t_v2,"v2")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<294>");
	t_v2->m_x=m_grid.At(0).At(0)*t_v1->m_x+m_grid.At(1).At(0)*t_v1->m_y+m_grid.At(2).At(0)*t_v1->m_z;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<295>");
	t_v2->m_y=m_grid.At(0).At(1)*t_v1->m_x+m_grid.At(1).At(1)*t_v1->m_y+m_grid.At(2).At(1)*t_v1->m_z;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<296>");
	t_v2->m_z=m_grid.At(0).At(2)*t_v1->m_x+m_grid.At(1).At(2)*t_v1->m_y+m_grid.At(2).At(2)*t_v1->m_z;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<298>");
	return t_v2;
}
c_Line* c_Matrix::p_Multiply3(c_Line* t_q){
	DBG_ENTER("Matrix.Multiply")
	c_Matrix *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_q,"q")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<610>");
	c_Vector* t_t=this->p_Multiply2(t_q->m_o);
	DBG_LOCAL(t_t,"t")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<611>");
	c_Line* t_=(new c_Line)->m_new2(t_t,this->p_Multiply2(t_q->m_o->p_Add(t_q->m_d))->p_Subtract(t_t));
	return t_;
}
void c_Matrix::p_CreateMatrix(Float t_rx,Float t_ry,Float t_rz,Float t_scx,Float t_scy,Float t_scz,Float t_px,Float t_py,Float t_pz){
	DBG_ENTER("Matrix.CreateMatrix")
	c_Matrix *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_rx,"rx")
	DBG_LOCAL(t_ry,"ry")
	DBG_LOCAL(t_rz,"rz")
	DBG_LOCAL(t_scx,"scx")
	DBG_LOCAL(t_scy,"scy")
	DBG_LOCAL(t_scz,"scz")
	DBG_LOCAL(t_px,"px")
	DBG_LOCAL(t_py,"py")
	DBG_LOCAL(t_pz,"pz")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<407>");
	Float t_sx=FLOAT(.0);
	Float t_sy=FLOAT(.0);
	Float t_sz=FLOAT(.0);
	Float t_cx=FLOAT(.0);
	Float t_cy=FLOAT(.0);
	Float t_cz=FLOAT(.0);
	Float t_theta=FLOAT(.0);
	DBG_LOCAL(t_sx,"sx")
	DBG_LOCAL(t_sy,"sy")
	DBG_LOCAL(t_sz,"sz")
	DBG_LOCAL(t_cx,"cx")
	DBG_LOCAL(t_cy,"cy")
	DBG_LOCAL(t_cz,"cz")
	DBG_LOCAL(t_theta,"theta")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<410>");
	t_sx=(Float)sin((t_rx)*D2R);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<411>");
	t_cx=(Float)cos((t_rx)*D2R);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<414>");
	t_sy=(Float)sin((t_ry)*D2R);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<415>");
	t_cy=(Float)cos((t_ry)*D2R);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<418>");
	t_sz=(Float)sin((t_rz)*D2R);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<419>");
	t_cz=(Float)cos((t_rz)*D2R);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<421>");
	Float t_sycz=t_sy*t_cz;
	DBG_LOCAL(t_sycz,"sycz")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<422>");
	Float t_cysz=t_cy*t_sz;
	DBG_LOCAL(t_cysz,"cysz")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<423>");
	Float t_sysz=t_sy*t_sz;
	DBG_LOCAL(t_sysz,"sysz")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<424>");
	Float t_cycz=t_cy*t_cz;
	DBG_LOCAL(t_cycz,"cycz")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<427>");
	m_grid.At(0).At(0)=(t_cycz+t_sysz*t_sx)*t_scx;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<428>");
	m_grid.At(0).At(1)=t_cx*t_sz*t_scx;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<429>");
	m_grid.At(0).At(2)=(-t_sycz+t_cysz*t_sx)*t_scx;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<430>");
	m_grid.At(0).At(3)=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<433>");
	m_grid.At(1).At(0)=(-t_cysz+t_sycz*t_sx)*t_scy;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<434>");
	m_grid.At(1).At(1)=t_cx*t_cz*t_scy;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<435>");
	m_grid.At(1).At(2)=(t_sysz+t_cycz*t_sx)*t_scy;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<436>");
	m_grid.At(1).At(3)=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<439>");
	m_grid.At(2).At(0)=t_sy*t_cx*t_scz;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<440>");
	m_grid.At(2).At(1)=-t_sx*t_scz;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<441>");
	m_grid.At(2).At(2)=t_cx*t_cy*t_scz;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<442>");
	m_grid.At(2).At(3)=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<444>");
	m_grid.At(3).At(0)=t_px;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<445>");
	m_grid.At(3).At(1)=t_py;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<446>");
	m_grid.At(3).At(2)=t_pz;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<447>");
	m_grid.At(3).At(3)=FLOAT(1.0);
}
void c_Matrix::p_FastRotateScale(Float t_rx,Float t_ry,Float t_rz,Float t_scx,Float t_scy,Float t_scz){
	DBG_ENTER("Matrix.FastRotateScale")
	c_Matrix *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_rx,"rx")
	DBG_LOCAL(t_ry,"ry")
	DBG_LOCAL(t_rz,"rz")
	DBG_LOCAL(t_scx,"scx")
	DBG_LOCAL(t_scy,"scy")
	DBG_LOCAL(t_scz,"scz")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<401>");
	p_CreateMatrix(t_rx,t_ry,t_rz,t_scx,t_scy,t_scz,m_grid.At(3).At(0),m_grid.At(3).At(1),m_grid.At(3).At(2));
}
void c_Matrix::p_RotateRoll(Float t_ang){
	DBG_ENTER("Matrix.RotateRoll")
	c_Matrix *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_ang,"ang")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<539>");
	Float t_cos_ang=(Float)cos((t_ang)*D2R);
	DBG_LOCAL(t_cos_ang,"cos_ang")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<540>");
	Float t_sin_ang=(Float)sin((t_ang)*D2R);
	DBG_LOCAL(t_sin_ang,"sin_ang")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<542>");
	Float t_m00=m_grid.At(0).At(0)*t_cos_ang+m_grid.At(1).At(0)*t_sin_ang;
	DBG_LOCAL(t_m00,"m00")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<543>");
	Float t_m01=m_grid.At(0).At(1)*t_cos_ang+m_grid.At(1).At(1)*t_sin_ang;
	DBG_LOCAL(t_m01,"m01")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<544>");
	Float t_m02=m_grid.At(0).At(2)*t_cos_ang+m_grid.At(1).At(2)*t_sin_ang;
	DBG_LOCAL(t_m02,"m02")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<546>");
	m_grid.At(1).At(0)=m_grid.At(0).At(0)*-t_sin_ang+m_grid.At(1).At(0)*t_cos_ang;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<547>");
	m_grid.At(1).At(1)=m_grid.At(0).At(1)*-t_sin_ang+m_grid.At(1).At(1)*t_cos_ang;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<548>");
	m_grid.At(1).At(2)=m_grid.At(0).At(2)*-t_sin_ang+m_grid.At(1).At(2)*t_cos_ang;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<550>");
	m_grid.At(0).At(0)=t_m00;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<551>");
	m_grid.At(0).At(1)=t_m01;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/matrix.monkey<552>");
	m_grid.At(0).At(2)=t_m02;
}
void c_Matrix::mark(){
	Object::mark();
	gc_mark_q(m_grid);
}
String c_Matrix::debug(){
	String t="(Matrix)\n";
	t+=dbg_decl("grid",&m_grid);
	return t;
}
c_Vector::c_Vector(){
	m_x=FLOAT(.0);
	m_y=FLOAT(.0);
	m_z=FLOAT(.0);
}
c_Vector* c_Vector::m_new(Float t_xx,Float t_yy,Float t_zz){
	DBG_ENTER("Vector.new")
	c_Vector *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_xx,"xx")
	DBG_LOCAL(t_yy,"yy")
	DBG_LOCAL(t_zz,"zz")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/vector.monkey<11>");
	m_x=t_xx;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/vector.monkey<12>");
	m_y=t_yy;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/vector.monkey<13>");
	m_z=t_zz;
	return this;
}
c_Vector* c_Vector::p_Copy(){
	DBG_ENTER("Vector.Copy")
	c_Vector *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/vector.monkey<25>");
	c_Vector* t_=(new c_Vector)->m_new(m_x,m_y,m_z);
	return t_;
}
c_Vector* c_Vector::p_Add(c_Vector* t_vec){
	DBG_ENTER("Vector.Add")
	c_Vector *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_vec,"vec")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/vector.monkey<31>");
	c_Vector* t_=(new c_Vector)->m_new(m_x+t_vec->m_x,m_y+t_vec->m_y,m_z+t_vec->m_z);
	return t_;
}
c_Vector* c_Vector::p_Add2(Float t_vx,Float t_vy,Float t_vz){
	DBG_ENTER("Vector.Add")
	c_Vector *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_vx,"vx")
	DBG_LOCAL(t_vy,"vy")
	DBG_LOCAL(t_vz,"vz")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/vector.monkey<37>");
	c_Vector* t_=(new c_Vector)->m_new(m_x+t_vx,m_y+t_vy,m_z+t_vz);
	return t_;
}
c_Vector* c_Vector::p_Subtract(c_Vector* t_vec){
	DBG_ENTER("Vector.Subtract")
	c_Vector *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_vec,"vec")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/vector.monkey<43>");
	c_Vector* t_=(new c_Vector)->m_new(m_x-t_vec->m_x,m_y-t_vec->m_y,m_z-t_vec->m_z);
	return t_;
}
c_Vector* c_Vector::p_Subtract2(Float t_vx,Float t_vy,Float t_vz){
	DBG_ENTER("Vector.Subtract")
	c_Vector *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_vx,"vx")
	DBG_LOCAL(t_vy,"vy")
	DBG_LOCAL(t_vz,"vz")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/vector.monkey<49>");
	c_Vector* t_=(new c_Vector)->m_new(m_x-t_vx,m_y-t_vy,m_z-t_vz);
	return t_;
}
c_Vector* c_Vector::p_Normalize(){
	DBG_ENTER("Vector.Normalize")
	c_Vector *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/vector.monkey<98>");
	if(m_x==FLOAT(0.0) && m_y==FLOAT(0.0) && m_z==FLOAT(0.0)){
		DBG_BLOCK();
		c_Vector* t_=(new c_Vector)->m_new(FLOAT(0.0),FLOAT(0.0),FLOAT(0.0));
		return t_;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/vector.monkey<100>");
	Float t_d=FLOAT(1.0)/(Float)sqrt(m_x*m_x+m_y*m_y+m_z*m_z);
	DBG_LOCAL(t_d,"d")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/vector.monkey<101>");
	c_Vector* t_2=(new c_Vector)->m_new(m_x*t_d,m_y*t_d,m_z*t_d);
	return t_2;
}
void c_Vector::mark(){
	Object::mark();
}
String c_Vector::debug(){
	String t="(Vector)\n";
	t+=dbg_decl("x",&m_x);
	t+=dbg_decl("y",&m_y);
	t+=dbg_decl("z",&m_z);
	return t;
}
c_TCollision::c_TCollision(){
	m_updated_shape=false;
}
c_TCollision* c_TCollision::m_new(){
	DBG_ENTER("TCollision.new")
	c_TCollision *self=this;
	DBG_LOCAL(self,"Self")
	return this;
}
void c_TCollision::mark(){
	Object::mark();
}
String c_TCollision::debug(){
	String t="(TCollision)\n";
	t+=dbg_decl("updated_shape",&m_updated_shape);
	return t;
}
c_List::c_List(){
	m__head=((new c_HeadNode)->m_new());
}
c_List* c_List::m_new(){
	DBG_ENTER("List.new")
	c_List *self=this;
	DBG_LOCAL(self,"Self")
	return this;
}
c_Node2* c_List::p_AddLast(c_TEntity* t_data){
	DBG_ENTER("List.AddLast")
	c_List *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<108>");
	c_Node2* t_=(new c_Node2)->m_new(m__head,m__head->m__pred,t_data);
	return t_;
}
c_List* c_List::m_new2(Array<c_TEntity* > t_data){
	DBG_ENTER("List.new")
	c_List *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<13>");
	Array<c_TEntity* > t_=t_data;
	int t_2=0;
	while(t_2<t_.Length()){
		DBG_BLOCK();
		c_TEntity* t_t=t_.At(t_2);
		t_2=t_2+1;
		DBG_LOCAL(t_t,"t")
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<14>");
		p_AddLast(t_t);
	}
	return this;
}
c_Node2* c_List::p_FirstNode(){
	DBG_ENTER("List.FirstNode")
	c_List *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<62>");
	if(m__head->m__succ!=m__head){
		DBG_BLOCK();
		return m__head->m__succ;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<63>");
	return 0;
}
c_Node2* c_List::p_AddFirst(c_TEntity* t_data){
	DBG_ENTER("List.AddFirst")
	c_List *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<104>");
	c_Node2* t_=(new c_Node2)->m_new(m__head->m__succ,m__head,t_data);
	return t_;
}
c_Enumerator7* c_List::p_ObjectEnumerator(){
	DBG_ENTER("List.ObjectEnumerator")
	c_List *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<186>");
	c_Enumerator7* t_=(new c_Enumerator7)->m_new(this);
	return t_;
}
bool c_List::p_IsEmpty(){
	DBG_ENTER("List.IsEmpty")
	c_List *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<50>");
	bool t_=m__head->m__succ==m__head;
	return t_;
}
void c_List::mark(){
	Object::mark();
	gc_mark_q(m__head);
}
String c_List::debug(){
	String t="(List)\n";
	t+=dbg_decl("_head",&m__head);
	return t;
}
c_EntityList::c_EntityList(){
}
c_EntityList* c_EntityList::m_new(){
	DBG_ENTER("EntityList.new")
	c_EntityList *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2343>");
	c_List::m_new();
	return this;
}
c_Node2* c_EntityList::p_EntityListAdd(c_TEntity* t_obj){
	DBG_ENTER("EntityList.EntityListAdd")
	c_EntityList *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_obj,"obj")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2349>");
	c_Node2* t_llink=this->p_FirstNode();
	DBG_LOCAL(t_llink,"llink")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2351>");
	if(t_obj->m_order>0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2355>");
		t_llink=this->p_AddFirst(t_obj);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2357>");
		return t_llink;
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2364>");
		t_llink=this->p_AddLast(t_obj);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2366>");
		return t_llink;
	}
}
void c_EntityList::mark(){
	c_List::mark();
}
String c_EntityList::debug(){
	String t="(EntityList)\n";
	t=c_List::debug()+t;
	return t;
}
c_Node2::c_Node2(){
	m__succ=0;
	m__pred=0;
	m__data=0;
}
c_Node2* c_Node2::m_new(c_Node2* t_succ,c_Node2* t_pred,c_TEntity* t_data){
	DBG_ENTER("Node.new")
	c_Node2 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_succ,"succ")
	DBG_LOCAL(t_pred,"pred")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<261>");
	gc_assign(m__succ,t_succ);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<262>");
	gc_assign(m__pred,t_pred);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<263>");
	gc_assign(m__succ->m__pred,this);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<264>");
	gc_assign(m__pred->m__succ,this);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<265>");
	gc_assign(m__data,t_data);
	return this;
}
c_Node2* c_Node2::m_new2(){
	DBG_ENTER("Node.new")
	c_Node2 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<258>");
	return this;
}
int c_Node2::p_Remove(){
	DBG_ENTER("Node.Remove")
	c_Node2 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<274>");
	if(m__succ->m__pred!=this){
		DBG_BLOCK();
		bbError(String(L"Illegal operation on removed node",33));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<276>");
	gc_assign(m__succ->m__pred,m__pred);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<277>");
	gc_assign(m__pred->m__succ,m__succ);
	return 0;
}
void c_Node2::mark(){
	Object::mark();
	gc_mark_q(m__succ);
	gc_mark_q(m__pred);
	gc_mark_q(m__data);
}
String c_Node2::debug(){
	String t="(Node)\n";
	t+=dbg_decl("_succ",&m__succ);
	t+=dbg_decl("_pred",&m__pred);
	t+=dbg_decl("_data",&m__data);
	return t;
}
c_HeadNode::c_HeadNode(){
}
c_HeadNode* c_HeadNode::m_new(){
	DBG_ENTER("HeadNode.new")
	c_HeadNode *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<310>");
	c_Node2::m_new2();
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<311>");
	gc_assign(m__succ,(this));
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<312>");
	gc_assign(m__pred,(this));
	return this;
}
void c_HeadNode::mark(){
	c_Node2::mark();
}
String c_HeadNode::debug(){
	String t="(HeadNode)\n";
	t=c_Node2::debug()+t;
	return t;
}
c_TMesh* bb_functions_CreateMesh(c_TEntity* t_parent){
	DBG_ENTER("CreateMesh")
	DBG_LOCAL(t_parent,"parent")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/functions.monkey<466>");
	c_TMesh* t_=c_TMesh::m_CreateMesh(t_parent);
	return t_;
}
c_TBrush::c_TBrush(){
	m_red=FLOAT(1.0);
	m_green=FLOAT(1.0);
	m_blue=FLOAT(1.0);
	m_tex=Array<c_TTexture* >(8);
	m_no_texs=0;
	m_fx=0;
	m_name=String();
	m_alpha=FLOAT(1.0);
	m_shine=FLOAT(0.05);
	m_shine_strength=FLOAT(100.0);
	m_blend=1;
}
c_TBrush* c_TBrush::m_new(){
	DBG_ENTER("TBrush.new")
	c_TBrush *self=this;
	DBG_LOCAL(self,"Self")
	return this;
}
c_TBrush* c_TBrush::m_new2(int t_hexcolor){
	DBG_ENTER("TBrush.new")
	c_TBrush *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_hexcolor,"hexcolor")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbrush.monkey<40>");
	m_red=Float((t_hexcolor&16711680)>>16)*FLOAT(0.0039215686274509803);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbrush.monkey<41>");
	m_green=Float((t_hexcolor&65280)>>8)*FLOAT(0.0039215686274509803);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbrush.monkey<42>");
	m_blue=Float(t_hexcolor&255)*FLOAT(0.0039215686274509803);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbrush.monkey<43>");
	gc_assign(m_tex.At(0),(new c_TTexture)->m_new());
	return this;
}
c_TBrush* c_TBrush::m_new3(int t_r,int t_g,int t_b){
	DBG_ENTER("TBrush.new")
	c_TBrush *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_r,"r")
	DBG_LOCAL(t_g,"g")
	DBG_LOCAL(t_b,"b")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbrush.monkey<49>");
	m_red=Float(t_r)*FLOAT(0.0039215686274509803);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbrush.monkey<50>");
	m_green=Float(t_g)*FLOAT(0.0039215686274509803);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbrush.monkey<51>");
	m_blue=Float(t_b)*FLOAT(0.0039215686274509803);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbrush.monkey<52>");
	gc_assign(m_tex.At(0),(new c_TTexture)->m_new());
	return this;
}
void c_TBrush::p_BrushTexture(c_TTexture* t_texture,int t_frame,int t_index){
	DBG_ENTER("TBrush.BrushTexture")
	c_TBrush *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_texture,"texture")
	DBG_LOCAL(t_frame,"frame")
	DBG_LOCAL(t_index,"index")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbrush.monkey<204>");
	gc_assign(m_tex.At(t_index),t_texture);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbrush.monkey<205>");
	if(t_index+1>m_no_texs){
		DBG_BLOCK();
		m_no_texs=t_index+1;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbrush.monkey<207>");
	if(t_frame<0){
		DBG_BLOCK();
		t_frame=0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbrush.monkey<208>");
	if(t_frame>t_texture->m_no_frames-1){
		DBG_BLOCK();
		t_frame=t_texture->m_no_frames-1;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbrush.monkey<209>");
	t_texture->m_tex_frame=t_frame;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbrush.monkey<211>");
	if(t_frame>0 && t_texture->m_no_frames>1){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbrush.monkey<213>");
		int t_x=t_frame % t_texture->m_frame_xstep;
		DBG_LOCAL(t_x,"x")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbrush.monkey<214>");
		int t_y=t_frame/t_texture->m_frame_ystep % t_texture->m_frame_ystep;
		DBG_LOCAL(t_y,"y")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbrush.monkey<215>");
		t_texture->m_u_pos=Float(t_x)*t_texture->m_frame_ustep;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbrush.monkey<216>");
		t_texture->m_v_pos=Float(t_y)*t_texture->m_frame_vstep;
	}
}
c_TBrush* c_TBrush::m_new4(c_TTexture* t_texture){
	DBG_ENTER("TBrush.new")
	c_TBrush *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_texture,"texture")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbrush.monkey<57>");
	p_BrushTexture(t_texture,0,0);
	return this;
}
c_TBrush* c_TBrush::p_Copy(){
	DBG_ENTER("TBrush.Copy")
	c_TBrush *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbrush.monkey<62>");
	c_TBrush* t_brush=(new c_TBrush)->m_new();
	DBG_LOCAL(t_brush,"brush")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbrush.monkey<64>");
	t_brush->m_no_texs=m_no_texs;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbrush.monkey<65>");
	t_brush->m_name=m_name;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbrush.monkey<66>");
	t_brush->m_red=m_red;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbrush.monkey<67>");
	t_brush->m_green=m_green;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbrush.monkey<68>");
	t_brush->m_blue=m_blue;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbrush.monkey<69>");
	t_brush->m_alpha=m_alpha;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbrush.monkey<70>");
	t_brush->m_shine=m_shine;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbrush.monkey<71>");
	t_brush->m_shine_strength=m_shine_strength;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbrush.monkey<72>");
	t_brush->m_blend=m_blend;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbrush.monkey<73>");
	t_brush->m_fx=m_fx;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbrush.monkey<84>");
	if((m_tex.At(0))!=0){
		DBG_BLOCK();
		gc_assign(t_brush->m_tex.At(0),m_tex.At(0));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbrush.monkey<85>");
	if((m_tex.At(1))!=0){
		DBG_BLOCK();
		gc_assign(t_brush->m_tex.At(1),m_tex.At(1));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbrush.monkey<86>");
	if((m_tex.At(2))!=0){
		DBG_BLOCK();
		gc_assign(t_brush->m_tex.At(2),m_tex.At(2));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbrush.monkey<87>");
	if((m_tex.At(3))!=0){
		DBG_BLOCK();
		gc_assign(t_brush->m_tex.At(3),m_tex.At(3));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbrush.monkey<88>");
	if((m_tex.At(4))!=0){
		DBG_BLOCK();
		gc_assign(t_brush->m_tex.At(4),m_tex.At(4));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbrush.monkey<89>");
	if((m_tex.At(5))!=0){
		DBG_BLOCK();
		gc_assign(t_brush->m_tex.At(5),m_tex.At(5));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbrush.monkey<90>");
	if((m_tex.At(6))!=0){
		DBG_BLOCK();
		gc_assign(t_brush->m_tex.At(6),m_tex.At(6));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbrush.monkey<91>");
	if((m_tex.At(7))!=0){
		DBG_BLOCK();
		gc_assign(t_brush->m_tex.At(7),m_tex.At(7));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbrush.monkey<93>");
	return t_brush;
}
c_TTexture* c_TBrush::p_GetTexture(int t_index){
	DBG_ENTER("TBrush.GetTexture")
	c_TBrush *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_index,"index")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbrush.monkey<223>");
	return m_tex.At(t_index);
}
void c_TBrush::mark(){
	Object::mark();
	gc_mark_q(m_tex);
}
String c_TBrush::debug(){
	String t="(TBrush)\n";
	t+=dbg_decl("no_texs",&m_no_texs);
	t+=dbg_decl("name",&m_name);
	t+=dbg_decl("red",&m_red);
	t+=dbg_decl("green",&m_green);
	t+=dbg_decl("blue",&m_blue);
	t+=dbg_decl("alpha",&m_alpha);
	t+=dbg_decl("shine",&m_shine);
	t+=dbg_decl("shine_strength",&m_shine_strength);
	t+=dbg_decl("blend",&m_blend);
	t+=dbg_decl("fx",&m_fx);
	t+=dbg_decl("tex",&m_tex);
	return t;
}
c_TTexture::c_TTexture(){
	m_resize_smooth=false;
	m_no_frames=1;
	m_tex_frame=0;
	m_frame_xstep=0;
	m_frame_ystep=0;
	m_frame_ustep=FLOAT(1.0);
	m_u_pos=FLOAT(.0);
	m_frame_vstep=FLOAT(1.0);
	m_v_pos=FLOAT(.0);
	m_bind_flags=-1;
	m_tex_link=0;
	m_pixmap=0;
	m_file=String();
	m_gltex=Array<int >(1);
	m_freeMemoryAfterBind=false;
	m_flags=0;
	m_orig_width=0;
	m_orig_height=0;
	m_width=0;
	m_height=0;
	m_frame_startx=0;
	m_frame_starty=0;
	m_u_scale=FLOAT(1.0);
	m_v_scale=FLOAT(1.0);
	m_is_font=false;
	m_blend=2;
	m_coords=0;
	m_angle=FLOAT(.0);
	m_cube_mode=1;
	m_tex_smooth=true;
	m_no_mipmaps=0;
}
bool c_TTexture::m_useGlobalResizeSmooth;
c_TTexture* c_TTexture::m_new(){
	DBG_ENTER("TTexture.new")
	c_TTexture *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<87>");
	m_resize_smooth=m_useGlobalResizeSmooth;
	return this;
}
c_TextureStack* c_TTexture::m_tex_bind_stack;
int c_TTexture::p_FreeTexture_(){
	DBG_ENTER("TTexture.FreeTexture_")
	c_TTexture *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<101>");
	m_tex_link->p_Remove();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<102>");
	if((m_pixmap)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<105>");
		m_pixmap->p_DecBind();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<106>");
		if(m_pixmap->p_GetBindCount()==0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<107>");
			c_TPixmap::m_preloader->p_RemoveFromStack(m_file);
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<108>");
			m_pixmap->p_FreePixmap();
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<113>");
	m_gltex.At(0)=0;
	return 0;
}
int c_TTexture::p_FilterFlags(){
	DBG_ENTER("TTexture.FilterFlags")
	c_TTexture *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<692>");
	c_Enumerator11* t_=c_TTextureFilter::m_filter_list->p_ObjectEnumerator();
	while(t_->p_HasNext()){
		DBG_BLOCK();
		c_TTextureFilter* t_filter=t_->p_NextObject();
		DBG_LOCAL(t_filter,"filter")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<693>");
		int t_len1=t_filter->m_text.Length();
		DBG_LOCAL(t_len1,"len1")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<694>");
		int t_len2=m_file.Length()-t_len1;
		DBG_LOCAL(t_len2,"len2")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<695>");
		String t_file2=m_file.Slice(t_len2);
		DBG_LOCAL(t_file2,"file2")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<696>");
		if(t_file2==t_filter->m_text){
			DBG_BLOCK();
			m_flags=m_flags|t_filter->m_flags;
		}
	}
	return 0;
}
c_List12* c_TTexture::m_tex_list;
c_TTexture* c_TTexture::p_TexInList(){
	DBG_ENTER("TTexture.TexInList")
	c_TTexture *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<677>");
	c_Enumerator12* t_=m_tex_list->p_ObjectEnumerator();
	while(t_->p_HasNext()){
		DBG_BLOCK();
		c_TTexture* t_tex=t_->p_NextObject();
		DBG_LOCAL(t_tex,"tex")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<678>");
		if(m_file==t_tex->m_file && m_flags==t_tex->m_flags){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<680>");
			return t_tex;
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<685>");
	return 0;
}
int c_TTexture::m_Pow2Size(int t_n){
	DBG_ENTER("TTexture.Pow2Size")
	DBG_LOCAL(t_n,"n")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<726>");
	int t_t=1;
	DBG_LOCAL(t_t,"t")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<727>");
	while(t_t<t_n){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<728>");
		t_t=t_t<<1;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<730>");
	return t_t;
}
c_TPixmap* c_TTexture::m_AdjustPixmap(c_TPixmap* t_pixmap,bool t_resize_smooth,c_TTexture* t_tex){
	DBG_ENTER("TTexture.AdjustPixmap")
	DBG_LOCAL(t_pixmap,"pixmap")
	DBG_LOCAL(t_resize_smooth,"resize_smooth")
	DBG_LOCAL(t_tex,"tex")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<704>");
	int t_width=m_Pow2Size(t_pixmap->m_width);
	DBG_LOCAL(t_width,"width")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<705>");
	int t_height=m_Pow2Size(t_pixmap->m_height);
	DBG_LOCAL(t_height,"height")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<709>");
	if(t_width!=t_pixmap->m_width || t_height!=t_pixmap->m_height){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<717>");
		if(t_resize_smooth){
			DBG_BLOCK();
			t_pixmap=t_pixmap->p_ResizePixmap(t_width,t_height);
		}else{
			DBG_BLOCK();
			t_pixmap=t_pixmap->p_ResizePixmapNoSmooth(t_width,t_height);
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<721>");
	return t_pixmap;
}
void c_TTexture::p_SetAnimationFrames(int t_first_frame,int t_frame_count,int t_frame_width,int t_frame_height){
	DBG_ENTER("TTexture.SetAnimationFrames")
	c_TTexture *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_first_frame,"first_frame")
	DBG_LOCAL(t_frame_count,"frame_count")
	DBG_LOCAL(t_frame_width,"frame_width")
	DBG_LOCAL(t_frame_height,"frame_height")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<329>");
	m_frame_xstep=m_pixmap->m_width/t_frame_width;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<330>");
	m_frame_ystep=m_pixmap->m_height/t_frame_height;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<332>");
	m_frame_startx=t_first_frame % m_frame_xstep;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<333>");
	m_frame_starty=t_first_frame/m_frame_ystep % m_frame_ystep;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<335>");
	if(t_frame_count<0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<336>");
		t_frame_count=m_frame_xstep*m_frame_ystep;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<339>");
	m_no_frames=t_frame_count;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<340>");
	if(m_no_frames>1){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<344>");
		m_frame_ustep=FLOAT(1.0)/Float(m_frame_xstep);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<345>");
		m_frame_vstep=FLOAT(1.0)/Float(m_frame_ystep);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<348>");
		m_u_scale=m_frame_ustep;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<349>");
		m_v_scale=m_frame_vstep;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<350>");
		m_u_pos=Float(m_frame_startx)*m_frame_ustep;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<351>");
		m_v_pos=Float(m_frame_starty)*m_frame_vstep;
	}
}
int c_TTexture::m_PushBindTexture(c_TTexture* t_tex,int t_flags){
	DBG_ENTER("TTexture.PushBindTexture")
	DBG_LOCAL(t_tex,"tex")
	DBG_LOCAL(t_flags,"flags")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<360>");
	t_tex->m_bind_flags=t_flags;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<361>");
	m_tex_bind_stack->p_Push7(t_tex);
	return 0;
}
c_TTexture* c_TTexture::m_LoadAnimTexture(String t_file,int t_flags,int t_frame_width,int t_frame_height,int t_first_frame,int t_frame_count,c_TTexture* t_tex,int t_force_new){
	DBG_ENTER("TTexture.LoadAnimTexture")
	DBG_LOCAL(t_file,"file")
	DBG_LOCAL(t_flags,"flags")
	DBG_LOCAL(t_frame_width,"frame_width")
	DBG_LOCAL(t_frame_height,"frame_height")
	DBG_LOCAL(t_first_frame,"first_frame")
	DBG_LOCAL(t_frame_count,"frame_count")
	DBG_LOCAL(t_tex,"tex")
	DBG_LOCAL(t_force_new,"force_new")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<264>");
	if(t_tex==0){
		DBG_BLOCK();
		t_tex=(new c_TTexture)->m_new();
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<266>");
	t_tex->m_file=t_file;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<269>");
	t_tex->p_FilterFlags();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<270>");
	if(t_flags>-1){
		DBG_BLOCK();
		t_tex->m_flags=t_flags;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<274>");
	c_TTexture* t_old_tex=0;
	DBG_LOCAL(t_old_tex,"old_tex")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<275>");
	if(!((t_force_new)!=0)){
		DBG_BLOCK();
		t_old_tex=t_tex->p_TexInList();
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<277>");
	if(t_old_tex!=0 && t_old_tex!=t_tex){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<279>");
		return t_old_tex;
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<281>");
		if(t_old_tex!=t_tex){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<282>");
			gc_assign(t_tex->m_tex_link,m_tex_list->p_AddLast12(t_tex));
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<287>");
	Float t_new_scx=FLOAT(1.0);
	Float t_new_scy=FLOAT(1.0);
	int t_oldw=0;
	int t_oldh=0;
	DBG_LOCAL(t_new_scx,"new_scx")
	DBG_LOCAL(t_new_scy,"new_scy")
	DBG_LOCAL(t_oldw,"oldw")
	DBG_LOCAL(t_oldh,"oldh")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<289>");
	gc_assign(t_tex->m_pixmap,c_TPixmap::m_LoadPixmap(t_file));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<290>");
	if(t_tex->m_pixmap->m_height==0){
		DBG_BLOCK();
		return t_tex;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<292>");
	t_oldw=t_tex->m_pixmap->m_width;
	t_oldh=t_tex->m_pixmap->m_height;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<293>");
	t_tex->m_orig_width=t_oldw;
	t_tex->m_orig_height=t_oldh;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<295>");
	if((t_tex->m_flags&256)==0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<296>");
		gc_assign(t_tex->m_pixmap,m_AdjustPixmap(t_tex->m_pixmap,t_tex->m_resize_smooth,t_tex));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<299>");
	t_tex->m_width=t_tex->m_pixmap->m_width;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<300>");
	t_tex->m_height=t_tex->m_pixmap->m_height;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<302>");
	if(t_oldw!=t_tex->m_width || t_oldh!=t_tex->m_height){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<303>");
		t_new_scx=Float(t_tex->m_width)/Float(t_oldw);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<304>");
		t_new_scy=Float(t_tex->m_height)/Float(t_oldh);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<308>");
	if(t_frame_width==0 && t_frame_height==0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<309>");
		t_frame_width=t_tex->m_pixmap->m_width;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<310>");
		t_frame_height=t_tex->m_pixmap->m_height;
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<313>");
		t_frame_width=int(Float(t_frame_width)*t_new_scx);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<314>");
		t_frame_height=int(Float(t_frame_height)*t_new_scy);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<317>");
	t_tex->p_SetAnimationFrames(t_first_frame,t_frame_count,t_frame_width,t_frame_height);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<320>");
	m_PushBindTexture(t_tex,t_flags);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<322>");
	return t_tex;
}
c_TTexture* c_TTexture::m_LoadTexture(String t_file,int t_flags,c_TTexture* t_tex){
	DBG_ENTER("TTexture.LoadTexture")
	DBG_LOCAL(t_file,"file")
	DBG_LOCAL(t_flags,"flags")
	DBG_LOCAL(t_tex,"tex")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<217>");
	c_TTexture* t_=m_LoadAnimTexture(t_file,t_flags,0,0,0,1,t_tex,0);
	return t_;
}
c_TTexture* c_TTexture::m_LoadTexture2(c_TPixmap* t_pixmap,int t_flags,c_TTexture* t_tex){
	DBG_ENTER("TTexture.LoadTexture")
	DBG_LOCAL(t_pixmap,"pixmap")
	DBG_LOCAL(t_flags,"flags")
	DBG_LOCAL(t_tex,"tex")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<224>");
	if(!((t_tex)!=0)){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<225>");
		t_tex=(new c_TTexture)->m_new();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<226>");
		gc_assign(t_tex->m_tex_link,m_tex_list->p_AddLast12(t_tex));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<229>");
	t_tex->p_FilterFlags();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<230>");
	if(t_flags>-1){
		DBG_BLOCK();
		t_tex->m_flags=t_flags;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<233>");
	if(t_pixmap==0){
		DBG_BLOCK();
		return t_tex;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<234>");
	gc_assign(t_tex->m_pixmap,t_pixmap);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<235>");
	if(t_tex->m_pixmap->m_height==0){
		DBG_BLOCK();
		return t_tex;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<239>");
	if((t_tex->m_flags&256)==0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<240>");
		gc_assign(t_tex->m_pixmap,m_AdjustPixmap(t_tex->m_pixmap,t_tex->m_resize_smooth,t_tex));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<243>");
	t_tex->m_width=t_tex->m_pixmap->m_width;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<244>");
	t_tex->m_height=t_tex->m_pixmap->m_height;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<246>");
	m_PushBindTexture(t_tex,t_flags);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<248>");
	return t_tex;
}
int c_TTexture::p_TextureBlend(int t_blend_no){
	DBG_ENTER("TTexture.TextureBlend")
	c_TTexture *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_blend_no,"blend_no")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<554>");
	m_blend=t_blend_no;
	return 0;
}
c_TTexture* c_TTexture::m_CreateTexture(int t_width,int t_height,int t_flags,int t_frames,c_TTexture* t_tex){
	DBG_ENTER("TTexture.CreateTexture")
	DBG_LOCAL(t_width,"width")
	DBG_LOCAL(t_height,"height")
	DBG_LOCAL(t_flags,"flags")
	DBG_LOCAL(t_frames,"frames")
	DBG_LOCAL(t_tex,"tex")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<182>");
	if(t_tex==0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<183>");
		t_tex=(new c_TTexture)->m_new();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<184>");
		gc_assign(t_tex->m_tex_link,m_tex_list->p_AddLast12(t_tex));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<187>");
	t_width=m_Pow2Size(t_width);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<188>");
	t_height=m_Pow2Size(t_height);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<189>");
	gc_assign(t_tex->m_pixmap,c_TPixmap::m_CreatePixmap(t_width*t_frames,t_height,4));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<191>");
	t_tex->m_flags=t_flags;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<194>");
	t_tex->m_no_frames=t_frames;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<195>");
	gc_assign(t_tex->m_gltex,t_tex->m_gltex.Slice(0,t_tex->m_no_frames));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<198>");
	c_TPixmap* t_pixmap=t_tex->m_pixmap;
	DBG_LOCAL(t_pixmap,"pixmap")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<200>");
	if((t_tex->m_flags&256)==0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<201>");
		t_pixmap=m_AdjustPixmap(t_pixmap,t_tex->m_resize_smooth,t_tex);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<203>");
	t_tex->m_width=t_pixmap->m_width;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<204>");
	t_tex->m_height=t_pixmap->m_height;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<205>");
	t_tex->m_orig_width=t_tex->m_width;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<206>");
	t_tex->m_orig_height=t_tex->m_height;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<208>");
	m_PushBindTexture(t_tex,t_flags);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<210>");
	return t_tex;
}
int c_TTexture::m_TextureFilter(String t_match_text,int t_flags){
	DBG_ENTER("TTexture.TextureFilter")
	DBG_LOCAL(t_match_text,"match_text")
	DBG_LOCAL(t_flags,"flags")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<623>");
	c_TTextureFilter* t_filter=(new c_TTextureFilter)->m_new();
	DBG_LOCAL(t_filter,"filter")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<624>");
	t_filter->m_text=t_match_text;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<625>");
	t_filter->m_flags=t_flags;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<627>");
	c_TTextureFilter::m_filter_list->p_AddLast11(t_filter);
	return 0;
}
int c_TTexture::p_ResizeNoSmooth(){
	DBG_ENTER("TTexture.ResizeNoSmooth")
	c_TTexture *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<737>");
	m_resize_smooth=false;
	return 0;
}
int c_TTexture::p_FreeTexture(){
	DBG_ENTER("TTexture.FreeTexture")
	c_TTexture *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<95>");
	m_PushBindTexture(this,-255);
	return 0;
}
void c_TTexture::mark(){
	Object::mark();
	gc_mark_q(m_tex_link);
	gc_mark_q(m_pixmap);
	gc_mark_q(m_gltex);
}
String c_TTexture::debug(){
	String t="(TTexture)\n";
	t+=dbg_decl("tex_bind_stack",&c_TTexture::m_tex_bind_stack);
	t+=dbg_decl("tex_list",&c_TTexture::m_tex_list);
	t+=dbg_decl("tex_link",&m_tex_link);
	t+=dbg_decl("width",&m_width);
	t+=dbg_decl("height",&m_height);
	t+=dbg_decl("pixmap",&m_pixmap);
	t+=dbg_decl("file",&m_file);
	t+=dbg_decl("coords",&m_coords);
	t+=dbg_decl("blend",&m_blend);
	t+=dbg_decl("u_scale",&m_u_scale);
	t+=dbg_decl("v_scale",&m_v_scale);
	t+=dbg_decl("u_pos",&m_u_pos);
	t+=dbg_decl("v_pos",&m_v_pos);
	t+=dbg_decl("angle",&m_angle);
	t+=dbg_decl("flags",&m_flags);
	t+=dbg_decl("bind_flags",&m_bind_flags);
	t+=dbg_decl("freeMemoryAfterBind",&m_freeMemoryAfterBind);
	t+=dbg_decl("tex_smooth",&m_tex_smooth);
	t+=dbg_decl("resize_smooth",&m_resize_smooth);
	t+=dbg_decl("orig_width",&m_orig_width);
	t+=dbg_decl("orig_height",&m_orig_height);
	t+=dbg_decl("useGlobalResizeSmooth",&c_TTexture::m_useGlobalResizeSmooth);
	t+=dbg_decl("no_frames",&m_no_frames);
	t+=dbg_decl("frame_ustep",&m_frame_ustep);
	t+=dbg_decl("frame_vstep",&m_frame_vstep);
	t+=dbg_decl("frame_xstep",&m_frame_xstep);
	t+=dbg_decl("frame_ystep",&m_frame_ystep);
	t+=dbg_decl("tex_frame",&m_tex_frame);
	t+=dbg_decl("frame_startx",&m_frame_startx);
	t+=dbg_decl("frame_starty",&m_frame_starty);
	t+=dbg_decl("gltex",&m_gltex);
	t+=dbg_decl("no_mipmaps",&m_no_mipmaps);
	t+=dbg_decl("cube_mode",&m_cube_mode);
	t+=dbg_decl("is_font",&m_is_font);
	return t;
}
c_TSurface::c_TSurface(){
	m_brush=(new c_TBrush)->m_new();
	m_surf_id=0;
	m_no_verts=0;
	m_no_tris=0;
	m_vbo_dyn=false;
	m_vert_data=(new c_VertexDataBuffer)->m_new();
	m_alpha_enable=false;
	m_vert_array_size=1;
	m_tri_array_size=1;
	m_tris=(new c_ShortBuffer)->m_new();
	m_reset_vbo=-1;
	int t_[]={0,0,0,0,0,0,0};
	m_vbo_id=Array<int >(t_,7);
	m_vert_anim=Array<c_TVertexAnim* >();
	m_anim_frame=0;
}
c_TSurface* c_TSurface::m_new(){
	DBG_ENTER("TSurface.new")
	c_TSurface *self=this;
	DBG_LOCAL(self,"Self")
	return this;
}
int c_TSurface::p_AddVertex(Float t_x,Float t_y,Float t_z,Float t_u,Float t_v,Float t_w){
	DBG_ENTER("TSurface.AddVertex")
	c_TSurface *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_x,"x")
	DBG_LOCAL(t_y,"y")
	DBG_LOCAL(t_z,"z")
	DBG_LOCAL(t_u,"u")
	DBG_LOCAL(t_v,"v")
	DBG_LOCAL(t_w,"w")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<238>");
	m_no_verts=m_no_verts+1;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<241>");
	if(m_no_verts>=m_vert_array_size){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<243>");
		do{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<244>");
			m_vert_array_size=m_vert_array_size+512;
		}while(!(m_vert_array_size>m_no_verts));
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<247>");
		int t_vas=m_vert_array_size;
		DBG_LOCAL(t_vas,"vas")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<249>");
		gc_assign(m_vert_data,bb_monkeybuffer_CopyDataBuffer2(m_vert_data,c_VertexDataBuffer::m_Create(t_vas)));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<256>");
	int t_vid=m_no_verts-1;
	DBG_LOCAL(t_vid,"vid")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<266>");
	Float t_[]={t_x,t_y,-t_z,FLOAT(0.0),FLOAT(1.0),FLOAT(1.0),FLOAT(1.0),FLOAT(0.0),FLOAT(1.0),FLOAT(1.0),FLOAT(1.0),FLOAT(1.0),t_u,t_v,t_u,t_v};
	Array<Float > t_data=Array<Float >(t_,16);
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<267>");
	m_vert_data->p_PokeFloatArray(t_vid,t_data,-1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<269>");
	return t_vid;
}
int c_TSurface::p_AddVertex2(Array<Float > t_data,int t_len){
	DBG_ENTER("TSurface.AddVertex")
	c_TSurface *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_LOCAL(t_len,"len")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<277>");
	if(t_len==-1){
		DBG_BLOCK();
		t_len=t_data.Length();
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<279>");
	int t_total=t_len>>4;
	DBG_LOCAL(t_total,"total")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<280>");
	int t_vid=m_no_verts;
	DBG_LOCAL(t_vid,"vid")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<281>");
	m_no_verts=m_no_verts+t_total;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<284>");
	if(m_no_verts>=m_vert_array_size){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<286>");
		do{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<287>");
			m_vert_array_size=m_vert_array_size+512;
		}while(!(m_vert_array_size>m_no_verts));
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<290>");
		int t_vas=m_vert_array_size;
		DBG_LOCAL(t_vas,"vas")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<292>");
		gc_assign(m_vert_data,bb_monkeybuffer_CopyDataBuffer2(m_vert_data,c_VertexDataBuffer::m_Create(t_vas)));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<297>");
	m_vert_data->p_PokeFloatArray(t_vid,t_data,t_len);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<298>");
	int t_=t_vid+(t_total-1);
	return t_;
}
int c_TSurface::p_AddTriangle(int t_v0,int t_v1,int t_v2){
	DBG_ENTER("TSurface.AddTriangle")
	c_TSurface *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_v0,"v0")
	DBG_LOCAL(t_v1,"v1")
	DBG_LOCAL(t_v2,"v2")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<303>");
	m_no_tris=m_no_tris+1;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<307>");
	if(m_no_tris>=m_tri_array_size){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<309>");
		do{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<310>");
			m_tri_array_size=m_tri_array_size+512;
		}while(!(m_tri_array_size>m_no_tris));
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<313>");
		int t_tas=m_tri_array_size;
		DBG_LOCAL(t_tas,"tas")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<315>");
		gc_assign(m_tris,bb_monkeybuffer_CopyShortBuffer(m_tris,c_ShortBuffer::m_Create(t_tas*3)));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<319>");
	int t_v0i=m_no_tris*3-3;
	DBG_LOCAL(t_v0i,"v0i")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<320>");
	int t_v1i=m_no_tris*3-2;
	DBG_LOCAL(t_v1i,"v1i")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<321>");
	int t_v2i=m_no_tris*3-1;
	DBG_LOCAL(t_v2i,"v2i")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<327>");
	int t_[]={t_v2,t_v1,t_v0};
	m_tris->p_Poke(t_v0i,Array<int >(t_,3),-1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<331>");
	m_reset_vbo=-1;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<333>");
	return m_no_tris;
}
int c_TSurface::p_AddTriangle2(Array<int > t_arr,int t_len){
	DBG_ENTER("TSurface.AddTriangle")
	c_TSurface *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_arr,"arr")
	DBG_LOCAL(t_len,"len")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<339>");
	if(t_len==-1){
		DBG_BLOCK();
		t_len=t_arr.Length();
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<341>");
	int t_t0=m_no_tris*3;
	DBG_LOCAL(t_t0,"t0")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<342>");
	m_no_tris=m_no_tris+t_len/3;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<346>");
	if(m_no_tris>=m_tri_array_size){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<348>");
		do{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<349>");
			m_tri_array_size=m_tri_array_size+512;
		}while(!(m_tri_array_size>m_no_tris));
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<352>");
		int t_tas=m_tri_array_size;
		DBG_LOCAL(t_tas,"tas")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<354>");
		gc_assign(m_tris,bb_monkeybuffer_CopyShortBuffer(m_tris,c_ShortBuffer::m_Create(t_tas*3)));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<359>");
	int t_temp=0;
	DBG_LOCAL(t_temp,"temp")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<360>");
	for(int t_t=0;t_t<=t_len-1;t_t=t_t+3){
		DBG_BLOCK();
		DBG_LOCAL(t_t,"t")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<361>");
		t_temp=t_arr.At(t_t);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<362>");
		t_arr.At(t_t)=t_arr.At(t_t+2);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<363>");
		t_arr.At(t_t+2)=t_temp;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<366>");
	m_tris->p_Poke(t_t0,t_arr,t_len);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<370>");
	m_reset_vbo=-1;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<372>");
	return m_no_tris;
}
int c_TSurface::p_VertexNormal(int t_vid,Float t_nx,Float t_ny,Float t_nz){
	DBG_ENTER("TSurface.VertexNormal")
	c_TSurface *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_vid,"vid")
	DBG_LOCAL(t_nx,"nx")
	DBG_LOCAL(t_ny,"ny")
	DBG_LOCAL(t_nz,"nz")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<418>");
	m_vert_data->p_PokeNormals(t_vid,t_nx,t_ny,-t_nz);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<421>");
	m_reset_vbo=m_reset_vbo|4;
	return 0;
}
int c_TSurface::p_VertexTexCoords(int t_vid,Float t_u,Float t_v,Float t_w,int t_coord_set){
	DBG_ENTER("TSurface.VertexTexCoords")
	c_TSurface *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_vid,"vid")
	DBG_LOCAL(t_u,"u")
	DBG_LOCAL(t_v,"v")
	DBG_LOCAL(t_w,"w")
	DBG_LOCAL(t_coord_set,"coord_set")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<427>");
	if(t_coord_set==0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<429>");
		m_vert_data->p_PokeTexCoords0(t_vid,t_u,t_v);
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<431>");
		if(t_coord_set==1){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<433>");
			m_vert_data->p_PokeTexCoords1(t_vid,t_u,t_v);
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<438>");
	m_reset_vbo=m_reset_vbo|2;
	return 0;
}
int c_TSurface::p_CropSurfaceBuffers(){
	DBG_ENTER("TSurface.CropSurfaceBuffers")
	c_TSurface *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<222>");
	if(m_no_verts<1 && m_no_tris<1){
		DBG_BLOCK();
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<224>");
	gc_assign(m_vert_data,bb_monkeybuffer_CopyDataBuffer2(m_vert_data,c_VertexDataBuffer::m_Create(m_no_verts)));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<226>");
	gc_assign(m_tris,bb_monkeybuffer_CopyShortBuffer(m_tris,c_ShortBuffer::m_Create(m_no_tris*3)));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<228>");
	m_vert_array_size=m_no_verts;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<229>");
	m_tri_array_size=m_no_tris;
	return 0;
}
int c_TSurface::p_ClearSurface(bool t_clear_verts,bool t_clear_tris,bool t_keep_array){
	DBG_ENTER("TSurface.ClearSurface")
	c_TSurface *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_clear_verts,"clear_verts")
	DBG_LOCAL(t_clear_tris,"clear_tris")
	DBG_LOCAL(t_keep_array,"keep_array")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<190>");
	if(t_clear_verts){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<192>");
		m_no_verts=0;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<194>");
		if(!t_keep_array){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<195>");
			gc_assign(m_vert_data,c_VertexDataBuffer::m_Create(0));
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<196>");
			m_vert_array_size=1;
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<201>");
	if(t_clear_tris){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<203>");
		m_no_tris=0;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<205>");
		if(!t_keep_array){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<206>");
			gc_assign(m_tris,c_ShortBuffer::m_Create(0));
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<207>");
			m_tri_array_size=1;
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<213>");
	m_reset_vbo=-1;
	return 0;
}
int c_TSurface::p_TriangleVertex(int t_tri_no,int t_corner){
	DBG_ENTER("TSurface.TriangleVertex")
	c_TSurface *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_tri_no,"tri_no")
	DBG_LOCAL(t_corner,"corner")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<526>");
	int t_=m_tris->p_Peek(t_tri_no*3+(2-t_corner));
	return t_;
}
int c_TSurface::p_UpdateNormals(bool t_create_only){
	DBG_ENTER("TSurface.UpdateNormals")
	c_TSurface *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_create_only,"create_only")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<536>");
	c_NormMap* t_norm_map=(new c_NormMap)->m_new();
	DBG_LOCAL(t_norm_map,"norm_map")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<538>");
	for(int t_t=0;t_t<=m_no_tris-1;t_t=t_t+1){
		DBG_BLOCK();
		DBG_LOCAL(t_t,"t")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<540>");
		int t_tri_no=(t_t+1)*3;
		DBG_LOCAL(t_tri_no,"tri_no")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<542>");
		int t_v0=m_tris->p_Peek(t_tri_no-3);
		DBG_LOCAL(t_v0,"v0")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<543>");
		int t_v1=m_tris->p_Peek(t_tri_no-2);
		DBG_LOCAL(t_v1,"v1")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<544>");
		int t_v2=m_tris->p_Peek(t_tri_no-1);
		DBG_LOCAL(t_v2,"v2")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<546>");
		Float t_ax=m_vert_data->p_VertexX(t_v1)-m_vert_data->p_VertexX(t_v0);
		DBG_LOCAL(t_ax,"ax")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<547>");
		Float t_ay=m_vert_data->p_VertexY(t_v1)-m_vert_data->p_VertexY(t_v0);
		DBG_LOCAL(t_ay,"ay")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<548>");
		Float t_az=m_vert_data->p_VertexZ(t_v1)-m_vert_data->p_VertexZ(t_v0);
		DBG_LOCAL(t_az,"az")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<550>");
		Float t_bx=m_vert_data->p_VertexX(t_v2)-m_vert_data->p_VertexX(t_v1);
		DBG_LOCAL(t_bx,"bx")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<551>");
		Float t_by=m_vert_data->p_VertexY(t_v2)-m_vert_data->p_VertexY(t_v1);
		DBG_LOCAL(t_by,"by")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<552>");
		Float t_bz=m_vert_data->p_VertexZ(t_v2)-m_vert_data->p_VertexZ(t_v1);
		DBG_LOCAL(t_bz,"bz")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<554>");
		Float t_nx=t_ay*t_bz-t_az*t_by;
		DBG_LOCAL(t_nx,"nx")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<555>");
		Float t_ny=t_az*t_bx-t_ax*t_bz;
		DBG_LOCAL(t_ny,"ny")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<556>");
		Float t_nz=t_ax*t_by-t_ay*t_bx;
		DBG_LOCAL(t_nz,"nz")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<558>");
		c_Vector* t_norm=(new c_Vector)->m_new(t_nx,t_ny,t_nz);
		DBG_LOCAL(t_norm,"norm")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<559>");
		c_Vector* t_vnorm=0;
		c_Vector* t_vx=0;
		c_Vector* t_new_norm=0;
		c_NormHelperClass* t_vhelper=0;
		DBG_LOCAL(t_vnorm,"vnorm")
		DBG_LOCAL(t_vx,"vx")
		DBG_LOCAL(t_new_norm,"new_norm")
		DBG_LOCAL(t_vhelper,"vhelper")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<561>");
		for(int t_c=0;t_c<=2;t_c=t_c+1){
			DBG_BLOCK();
			DBG_LOCAL(t_c,"c")
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<563>");
			int t_v=p_TriangleVertex(t_t,t_c);
			DBG_LOCAL(t_v,"v")
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<565>");
			t_vx=m_vert_data->p_PeekVertCoords(t_v);
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<567>");
			t_vhelper=t_norm_map->p_Get3(t_vx);
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<570>");
			if(!((t_vhelper)!=0)){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<571>");
				t_vhelper=(new c_NormHelperClass)->m_new();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<572>");
				gc_assign(t_vhelper->m_vec,(new c_Vector)->m_new(FLOAT(0.0),FLOAT(0.0),FLOAT(0.0)));
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<573>");
				t_vhelper->m_vert=t_v;
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<577>");
			gc_assign(t_vhelper->m_vec,t_norm->p_Add(t_vhelper->m_vec));
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<579>");
			if(!t_create_only){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<580>");
				t_norm_map->p_Set3(t_vx,t_vhelper);
			}
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<590>");
	for(int t_v3=0;t_v3<=m_no_verts-1;t_v3=t_v3+1){
		DBG_BLOCK();
		DBG_LOCAL(t_v3,"v")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<591>");
		c_Vector* t_vx2=m_vert_data->p_PeekVertCoords(t_v3);
		DBG_LOCAL(t_vx2,"vx")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<593>");
		c_NormHelperClass* t_norm2=t_norm_map->p_Get3(t_vx2);
		DBG_LOCAL(t_norm2,"norm")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<596>");
		if((t_norm2)!=0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<597>");
			gc_assign(t_norm2->m_vec,t_norm2->m_vec->p_Normalize());
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<599>");
			m_vert_data->p_PokeNormals(t_v3,t_norm2->m_vec->m_x,t_norm2->m_vec->m_y,t_norm2->m_vec->m_z);
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<605>");
	m_reset_vbo=m_reset_vbo|4;
	return 0;
}
int c_TSurface::p_VertexColor(int t_vid,Float t_r,Float t_g,Float t_b,Float t_a){
	DBG_ENTER("TSurface.VertexColor")
	c_TSurface *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_vid,"vid")
	DBG_LOCAL(t_r,"r")
	DBG_LOCAL(t_g,"g")
	DBG_LOCAL(t_b,"b")
	DBG_LOCAL(t_a,"a")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<400>");
	m_vert_data->p_PokeColor(t_vid,t_r*FLOAT(0.0039215686274509803),t_g*FLOAT(0.0039215686274509803),t_b*FLOAT(0.0039215686274509803),t_a);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<403>");
	m_reset_vbo=m_reset_vbo|8;
	return 0;
}
int c_TSurface::p_PaintSurface(c_TBrush* t_bru){
	DBG_ENTER("TSurface.PaintSurface")
	c_TSurface *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_bru,"bru")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<163>");
	if(m_brush==0){
		DBG_BLOCK();
		gc_assign(m_brush,(new c_TBrush)->m_new());
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<165>");
	m_brush->m_no_texs=t_bru->m_no_texs;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<166>");
	m_brush->m_name=t_bru->m_name;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<167>");
	m_brush->m_red=t_bru->m_red;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<168>");
	m_brush->m_green=t_bru->m_green;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<169>");
	m_brush->m_blue=t_bru->m_blue;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<170>");
	m_brush->m_alpha=t_bru->m_alpha;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<171>");
	m_brush->m_shine=t_bru->m_shine;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<172>");
	m_brush->m_blend=t_bru->m_blend;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<173>");
	m_brush->m_fx=t_bru->m_fx;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<175>");
	for(int t_i=0;t_i<=7;t_i=t_i+1){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<176>");
		gc_assign(m_brush->m_tex.At(t_i),t_bru->m_tex.At(t_i));
	}
	return 0;
}
int c_TSurface::p_PaintSurface2(c_TTexture* t_tex,int t_index){
	DBG_ENTER("TSurface.PaintSurface")
	c_TSurface *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_tex,"tex")
	DBG_LOCAL(t_index,"index")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<182>");
	if(m_brush==0){
		DBG_BLOCK();
		gc_assign(m_brush,(new c_TBrush)->m_new());
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<183>");
	m_brush->m_no_texs=bb_math2_Max(m_brush->m_no_texs,t_index+1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<184>");
	gc_assign(m_brush->m_tex.At(t_index),t_tex);
	return 0;
}
void c_TSurface::mark(){
	Object::mark();
	gc_mark_q(m_brush);
	gc_mark_q(m_vert_data);
	gc_mark_q(m_tris);
	gc_mark_q(m_vbo_id);
	gc_mark_q(m_vert_anim);
}
String c_TSurface::debug(){
	String t="(TSurface)\n";
	t+=dbg_decl("no_verts",&m_no_verts);
	t+=dbg_decl("no_tris",&m_no_tris);
	t+=dbg_decl("tris",&m_tris);
	t+=dbg_decl("vert_data",&m_vert_data);
	t+=dbg_decl("surf_id",&m_surf_id);
	t+=dbg_decl("vert_anim",&m_vert_anim);
	t+=dbg_decl("anim_frame",&m_anim_frame);
	t+=dbg_decl("brush",&m_brush);
	t+=dbg_decl("vbo_id",&m_vbo_id);
	t+=dbg_decl("vert_array_size",&m_vert_array_size);
	t+=dbg_decl("tri_array_size",&m_tri_array_size);
	t+=dbg_decl("reset_vbo",&m_reset_vbo);
	t+=dbg_decl("vbo_dyn",&m_vbo_dyn);
	t+=dbg_decl("alpha_enable",&m_alpha_enable);
	return t;
}
c_List2::c_List2(){
	m__head=((new c_HeadNode2)->m_new());
}
c_List2* c_List2::m_new(){
	DBG_ENTER("List.new")
	c_List2 *self=this;
	DBG_LOCAL(self,"Self")
	return this;
}
c_Node3* c_List2::p_AddLast2(c_TSurface* t_data){
	DBG_ENTER("List.AddLast")
	c_List2 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<108>");
	c_Node3* t_=(new c_Node3)->m_new(m__head,m__head->m__pred,t_data);
	return t_;
}
c_List2* c_List2::m_new2(Array<c_TSurface* > t_data){
	DBG_ENTER("List.new")
	c_List2 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<13>");
	Array<c_TSurface* > t_=t_data;
	int t_2=0;
	while(t_2<t_.Length()){
		DBG_BLOCK();
		c_TSurface* t_t=t_.At(t_2);
		t_2=t_2+1;
		DBG_LOCAL(t_t,"t")
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<14>");
		p_AddLast2(t_t);
	}
	return this;
}
int c_List2::p_Clear(){
	DBG_ENTER("List.Clear")
	c_List2 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<36>");
	gc_assign(m__head->m__succ,m__head);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<37>");
	gc_assign(m__head->m__pred,m__head);
	return 0;
}
c_Enumerator8* c_List2::p_ObjectEnumerator(){
	DBG_ENTER("List.ObjectEnumerator")
	c_List2 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<186>");
	c_Enumerator8* t_=(new c_Enumerator8)->m_new(this);
	return t_;
}
void c_List2::mark(){
	Object::mark();
	gc_mark_q(m__head);
}
String c_List2::debug(){
	String t="(List)\n";
	t+=dbg_decl("_head",&m__head);
	return t;
}
c_Node3::c_Node3(){
	m__succ=0;
	m__pred=0;
	m__data=0;
}
c_Node3* c_Node3::m_new(c_Node3* t_succ,c_Node3* t_pred,c_TSurface* t_data){
	DBG_ENTER("Node.new")
	c_Node3 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_succ,"succ")
	DBG_LOCAL(t_pred,"pred")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<261>");
	gc_assign(m__succ,t_succ);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<262>");
	gc_assign(m__pred,t_pred);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<263>");
	gc_assign(m__succ->m__pred,this);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<264>");
	gc_assign(m__pred->m__succ,this);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<265>");
	gc_assign(m__data,t_data);
	return this;
}
c_Node3* c_Node3::m_new2(){
	DBG_ENTER("Node.new")
	c_Node3 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<258>");
	return this;
}
void c_Node3::mark(){
	Object::mark();
	gc_mark_q(m__succ);
	gc_mark_q(m__pred);
	gc_mark_q(m__data);
}
String c_Node3::debug(){
	String t="(Node)\n";
	t+=dbg_decl("_succ",&m__succ);
	t+=dbg_decl("_pred",&m__pred);
	t+=dbg_decl("_data",&m__data);
	return t;
}
c_HeadNode2::c_HeadNode2(){
}
c_HeadNode2* c_HeadNode2::m_new(){
	DBG_ENTER("HeadNode.new")
	c_HeadNode2 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<310>");
	c_Node3::m_new2();
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<311>");
	gc_assign(m__succ,(this));
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<312>");
	gc_assign(m__pred,(this));
	return this;
}
void c_HeadNode2::mark(){
	c_Node3::mark();
}
String c_HeadNode2::debug(){
	String t="(HeadNode)\n";
	t=c_Node3::debug()+t;
	return t;
}
c_TColTree::c_TColTree(){
	m_reset_col_tree=0;
}
c_TColTree* c_TColTree::m_new(){
	DBG_ENTER("TColTree.new")
	c_TColTree *self=this;
	DBG_LOCAL(self,"Self")
	return this;
}
void c_TColTree::mark(){
	Object::mark();
}
String c_TColTree::debug(){
	String t="(TColTree)\n";
	t+=dbg_decl("reset_col_tree",&m_reset_col_tree);
	return t;
}
c_MojoSurface::c_MojoSurface(){
	m_tex=0;
	m_path=String();
	m_loaded=0;
	m_xstep=FLOAT(.0);
	m_ystep=FLOAT(.0);
}
c_MojoSurface* c_MojoSurface::m_new(){
	DBG_ENTER("MojoSurface.new")
	c_MojoSurface *self=this;
	DBG_LOCAL(self,"Self")
	return this;
}
c_MojoSurface* c_MojoSurface::m_Create(String t_path){
	DBG_ENTER("MojoSurface.Create")
	DBG_LOCAL(t_path,"path")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<522>");
	c_MojoSurface* t_s=(new c_MojoSurface)->m_new();
	DBG_LOCAL(t_s,"s")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<523>");
	gc_assign(t_s->m_tex,bb_functions_CreateTexture(0,0,1,1));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<524>");
	if(t_path!=String()){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<525>");
		t_s->m_path=t_path;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<528>");
	return t_s;
}
Array<String > c_MojoSurface::m_list;
bool c_MojoSurface::m_isLoading;
int c_MojoSurface::Width(){
	DBG_ENTER("MojoSurface.Width")
	c_MojoSurface *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<581>");
	return m_tex->m_orig_width;
}
int c_MojoSurface::Height(){
	DBG_ENTER("MojoSurface.Height")
	c_MojoSurface *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<585>");
	return m_tex->m_orig_height;
}
bool c_MojoSurface::p_LoadTexture(String t_path,c_TMesh* t_mesh,c_MojoEmulationDevice* t_device){
	DBG_ENTER("MojoSurface.LoadTexture")
	c_MojoSurface *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_path,"path")
	DBG_LOCAL(t_mesh,"mesh")
	DBG_LOCAL(t_device,"device")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<554>");
	m_tex->p_ResizeNoSmooth();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<556>");
	m_tex->m_pixmap->p_ClearBind();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<557>");
	c_TTexture::m_LoadAnimTexture(t_path,3,0,0,0,1,m_tex,1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<561>");
	m_loaded=1;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<565>");
	m_xstep=FLOAT(1.0)/Float(Width());
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<566>");
	m_ystep=FLOAT(1.0)/Float(Height());
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<568>");
	bool t_=m_tex!=0;
	return t_;
}
c_MojoSurface* c_MojoSurface::m_PreLoad(String t_path,c_TMesh* t_mesh,c_MojoEmulationDevice* t_device){
	DBG_ENTER("MojoSurface.PreLoad")
	DBG_LOCAL(t_path,"path")
	DBG_LOCAL(t_mesh,"mesh")
	DBG_LOCAL(t_device,"device")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<533>");
	c_MojoSurface* t_s=m_Create(t_path);
	DBG_LOCAL(t_s,"s")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<535>");
	int t_sz=m_list.Length();
	DBG_LOCAL(t_sz,"sz")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<536>");
	gc_assign(m_list,m_list.Resize(t_sz+1));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<537>");
	m_list.At(t_sz)=t_path;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<540>");
	m_isLoading=true;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<543>");
	t_s->p_LoadTexture(t_path,t_mesh,t_device);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<546>");
	return t_s;
}
int c_MojoSurface::Discard(){
	DBG_ENTER("MojoSurface.Discard")
	c_MojoSurface *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<573>");
	if((m_tex)!=0){
		DBG_BLOCK();
		m_tex->p_FreeTexture();
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<575>");
	m_tex=0;
	return 0;
}
int c_MojoSurface::Loaded(){
	DBG_ENTER("MojoSurface.Loaded")
	c_MojoSurface *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<588>");
	return m_loaded;
}
void c_MojoSurface::mark(){
	gxtkSurface::mark();
	gc_mark_q(m_tex);
}
String c_MojoSurface::debug(){
	String t="(MojoSurface)\n";
	t+=dbg_decl("tex",&m_tex);
	t+=dbg_decl("xstep",&m_xstep);
	t+=dbg_decl("ystep",&m_ystep);
	t+=dbg_decl("path",&m_path);
	t+=dbg_decl("loaded",&m_loaded);
	t+=dbg_decl("isLoading",&c_MojoSurface::m_isLoading);
	t+=dbg_decl("list",&c_MojoSurface::m_list);
	return t;
}
c_List3::c_List3(){
	m__head=((new c_HeadNode3)->m_new());
}
c_List3* c_List3::m_new(){
	DBG_ENTER("List.new")
	c_List3 *self=this;
	DBG_LOCAL(self,"Self")
	return this;
}
c_Node4* c_List3::p_AddLast3(c_TMesh* t_data){
	DBG_ENTER("List.AddLast")
	c_List3 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<108>");
	c_Node4* t_=(new c_Node4)->m_new(m__head,m__head->m__pred,t_data);
	return t_;
}
c_List3* c_List3::m_new2(Array<c_TMesh* > t_data){
	DBG_ENTER("List.new")
	c_List3 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<13>");
	Array<c_TMesh* > t_=t_data;
	int t_2=0;
	while(t_2<t_.Length()){
		DBG_BLOCK();
		c_TMesh* t_t=t_.At(t_2);
		t_2=t_2+1;
		DBG_LOCAL(t_t,"t")
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<14>");
		p_AddLast3(t_t);
	}
	return this;
}
int c_List3::p_Clear(){
	DBG_ENTER("List.Clear")
	c_List3 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<36>");
	gc_assign(m__head->m__succ,m__head);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<37>");
	gc_assign(m__head->m__pred,m__head);
	return 0;
}
int c_List3::p_Compare2(c_TMesh* t_lhs,c_TMesh* t_rhs){
	DBG_ENTER("List.Compare")
	c_List3 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_lhs,"lhs")
	DBG_LOCAL(t_rhs,"rhs")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<32>");
	bbError(String(L"Unable to compare items",23));
	return 0;
}
int c_List3::p_Sort(int t_ascending){
	DBG_ENTER("List.Sort")
	c_List3 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_ascending,"ascending")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<194>");
	int t_ccsgn=-1;
	DBG_LOCAL(t_ccsgn,"ccsgn")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<195>");
	if((t_ascending)!=0){
		DBG_BLOCK();
		t_ccsgn=1;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<196>");
	int t_insize=1;
	DBG_LOCAL(t_insize,"insize")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<198>");
	do{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<199>");
		int t_merges=0;
		DBG_LOCAL(t_merges,"merges")
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<200>");
		c_Node4* t_tail=m__head;
		DBG_LOCAL(t_tail,"tail")
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<201>");
		c_Node4* t_p=m__head->m__succ;
		DBG_LOCAL(t_p,"p")
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<203>");
		while(t_p!=m__head){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<204>");
			t_merges+=1;
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<205>");
			c_Node4* t_q=t_p->m__succ;
			int t_qsize=t_insize;
			int t_psize=1;
			DBG_LOCAL(t_q,"q")
			DBG_LOCAL(t_qsize,"qsize")
			DBG_LOCAL(t_psize,"psize")
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<207>");
			while(t_psize<t_insize && t_q!=m__head){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<208>");
				t_psize+=1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<209>");
				t_q=t_q->m__succ;
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<212>");
			do{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<213>");
				c_Node4* t_t=0;
				DBG_LOCAL(t_t,"t")
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<214>");
				if(((t_psize)!=0) && ((t_qsize)!=0) && t_q!=m__head){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<215>");
					int t_cc=p_Compare2(t_p->m__data,t_q->m__data)*t_ccsgn;
					DBG_LOCAL(t_cc,"cc")
					DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<216>");
					if(t_cc<=0){
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<217>");
						t_t=t_p;
						DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<218>");
						t_p=t_p->m__succ;
						DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<219>");
						t_psize-=1;
					}else{
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<221>");
						t_t=t_q;
						DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<222>");
						t_q=t_q->m__succ;
						DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<223>");
						t_qsize-=1;
					}
				}else{
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<225>");
					if((t_psize)!=0){
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<226>");
						t_t=t_p;
						DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<227>");
						t_p=t_p->m__succ;
						DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<228>");
						t_psize-=1;
					}else{
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<229>");
						if(((t_qsize)!=0) && t_q!=m__head){
							DBG_BLOCK();
							DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<230>");
							t_t=t_q;
							DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<231>");
							t_q=t_q->m__succ;
							DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<232>");
							t_qsize-=1;
						}else{
							DBG_BLOCK();
							DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<234>");
							break;
						}
					}
				}
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<236>");
				gc_assign(t_t->m__pred,t_tail);
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<237>");
				gc_assign(t_tail->m__succ,t_t);
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<238>");
				t_tail=t_t;
			}while(!(false));
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<240>");
			t_p=t_q;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<242>");
		gc_assign(t_tail->m__succ,m__head);
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<243>");
		gc_assign(m__head->m__pred,t_tail);
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<245>");
		if(t_merges<=1){
			DBG_BLOCK();
			return 0;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<247>");
		t_insize*=2;
	}while(!(false));
}
c_Enumerator9* c_List3::p_ObjectEnumerator(){
	DBG_ENTER("List.ObjectEnumerator")
	c_List3 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<186>");
	c_Enumerator9* t_=(new c_Enumerator9)->m_new(this);
	return t_;
}
bool c_List3::p_IsEmpty(){
	DBG_ENTER("List.IsEmpty")
	c_List3 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<50>");
	bool t_=m__head->m__succ==m__head;
	return t_;
}
void c_List3::mark(){
	Object::mark();
	gc_mark_q(m__head);
}
String c_List3::debug(){
	String t="(List)\n";
	t+=dbg_decl("_head",&m__head);
	return t;
}
c_Node4::c_Node4(){
	m__succ=0;
	m__pred=0;
	m__data=0;
}
c_Node4* c_Node4::m_new(c_Node4* t_succ,c_Node4* t_pred,c_TMesh* t_data){
	DBG_ENTER("Node.new")
	c_Node4 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_succ,"succ")
	DBG_LOCAL(t_pred,"pred")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<261>");
	gc_assign(m__succ,t_succ);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<262>");
	gc_assign(m__pred,t_pred);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<263>");
	gc_assign(m__succ->m__pred,this);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<264>");
	gc_assign(m__pred->m__succ,this);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<265>");
	gc_assign(m__data,t_data);
	return this;
}
c_Node4* c_Node4::m_new2(){
	DBG_ENTER("Node.new")
	c_Node4 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<258>");
	return this;
}
void c_Node4::mark(){
	Object::mark();
	gc_mark_q(m__succ);
	gc_mark_q(m__pred);
	gc_mark_q(m__data);
}
String c_Node4::debug(){
	String t="(Node)\n";
	t+=dbg_decl("_succ",&m__succ);
	t+=dbg_decl("_pred",&m__pred);
	t+=dbg_decl("_data",&m__data);
	return t;
}
c_HeadNode3::c_HeadNode3(){
}
c_HeadNode3* c_HeadNode3::m_new(){
	DBG_ENTER("HeadNode.new")
	c_HeadNode3 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<310>");
	c_Node4::m_new2();
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<311>");
	gc_assign(m__succ,(this));
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<312>");
	gc_assign(m__pred,(this));
	return this;
}
void c_HeadNode3::mark(){
	c_Node4::mark();
}
String c_HeadNode3::debug(){
	String t="(HeadNode)\n";
	t=c_Node4::debug()+t;
	return t;
}
c_TPixmap::c_TPixmap(){
	m_bind=0;
	m_width=0;
	m_height=0;
}
c_TPixmapPreloader* c_TPixmap::m_preloader;
int c_TPixmap::m_PreLoadPixmap(Array<String > t_file){
	DBG_ENTER("TPixmap.PreLoadPixmap")
	DBG_LOCAL(t_file,"file")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<54>");
	int t_=m_preloader->p_PreLoad2(t_file);
	return t_;
}
void c_TPixmap::p_DecBind(){
	DBG_ENTER("TPixmap.DecBind")
	c_TPixmap *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<107>");
	m_bind-=1;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<108>");
	if(m_bind<0){
		DBG_BLOCK();
		m_bind=0;
	}
}
int c_TPixmap::p_GetBindCount(){
	DBG_ENTER("TPixmap.GetBindCount")
	c_TPixmap *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<112>");
	return m_bind;
}
c_IPixmapManager* c_TPixmap::m_manager;
c_TPixmap* c_TPixmap::m_LoadPixmap(String t_f){
	DBG_ENTER("TPixmap.LoadPixmap")
	DBG_LOCAL(t_f,"f")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<67>");
	c_TPixmap* t_=m_manager->p_LoadPixmap(t_f);
	return t_;
}
c_TPixmap* c_TPixmap::p_Copy(){
	DBG_ENTER("TPixmap.Copy")
	c_TPixmap *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<47>");
	c_TPixmap* t_=p_ResizePixmapNoSmooth(m_width,m_height);
	return t_;
}
void c_TPixmap::p_MaskPixmap(int t_r,int t_g,int t_b){
	DBG_ENTER("TPixmap.MaskPixmap")
	c_TPixmap *self=this;
	DBG_LOCAL(self,"Self")
}
void c_TPixmap::p_SetPixel(int t_x,int t_y,int t_r,int t_g,int t_b,int t_a){
	DBG_ENTER("TPixmap.SetPixel")
	c_TPixmap *self=this;
	DBG_LOCAL(self,"Self")
}
c_TPixmap* c_TPixmap::m_CreatePixmap(int t_w,int t_h,int t_format){
	DBG_ENTER("TPixmap.CreatePixmap")
	DBG_LOCAL(t_w,"w")
	DBG_LOCAL(t_h,"h")
	DBG_LOCAL(t_format,"format")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<72>");
	c_TPixmap* t_=m_manager->p_CreatePixmap(t_w,t_h,t_format);
	return t_;
}
c_TPixmap* c_TPixmap::m_new(){
	DBG_ENTER("TPixmap.new")
	c_TPixmap *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<37>");
	return this;
}
int c_TPixmap::p_GetPixel(int t_x,int t_y){
	DBG_ENTER("TPixmap.GetPixel")
	c_TPixmap *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_x,"x")
	DBG_LOCAL(t_y,"y")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<95>");
	return 0;
}
void c_TPixmap::p_SetBind(){
	DBG_ENTER("TPixmap.SetBind")
	c_TPixmap *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<103>");
	m_bind+=1;
}
void c_TPixmap::p_ClearBind(){
	DBG_ENTER("TPixmap.ClearBind")
	c_TPixmap *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<116>");
	m_bind=0;
}
void c_TPixmap::mark(){
	Object::mark();
}
String c_TPixmap::debug(){
	String t="(TPixmap)\n";
	t+=dbg_decl("manager",&c_TPixmap::m_manager);
	t+=dbg_decl("preloader",&c_TPixmap::m_preloader);
	t+=dbg_decl("width",&m_width);
	t+=dbg_decl("height",&m_height);
	t+=dbg_decl("bind",&m_bind);
	return t;
}
c_TPixmapPreloader::c_TPixmapPreloader(){
	m_manager=0;
	m_old_file=Array<String >(1);
	m_start_stack=(new c_Stack2)->m_new();
	m_finish_stack=(new c_Stack2)->m_new();
	m_total=0;
	m_loading=false;
}
int c_TPixmapPreloader::p_CheckAllLoaded(){
	DBG_ENTER("TPixmapPreloader.CheckAllLoaded")
	c_TPixmapPreloader *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<211>");
	if(m_start_stack->p_IsEmpty()){
		DBG_BLOCK();
		m_loading=false;
		return 1;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<212>");
	return 0;
}
int c_TPixmapPreloader::p_PreLoad2(Array<String > t_file){
	DBG_ENTER("TPixmapPreloader.PreLoad")
	c_TPixmapPreloader *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_file,"file")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<228>");
	if(!((m_manager)!=0)){
		DBG_BLOCK();
		bbError(String(L"**ERROR: no preload manager",27));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<234>");
	if(t_file.At(0)!=m_old_file.At(0) || t_file.At(t_file.Length()-1)!=m_old_file.At(m_old_file.Length()-1)){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<237>");
		Array<String > t_=t_file;
		int t_2=0;
		while(t_2<t_.Length()){
			DBG_BLOCK();
			String t_f=t_.At(t_2);
			t_2=t_2+1;
			DBG_LOCAL(t_f,"f")
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<239>");
			if(t_f==String()){
				DBG_BLOCK();
				continue;
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<242>");
			bool t_skip=false;
			DBG_LOCAL(t_skip,"skip")
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<243>");
			c_Enumerator* t_3=m_start_stack->p_ObjectEnumerator();
			while(t_3->p_HasNext()){
				DBG_BLOCK();
				c_PixmapStack* t_ss=t_3->p_NextObject();
				DBG_LOCAL(t_ss,"ss")
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<244>");
				if(t_ss->m_file==t_f){
					DBG_BLOCK();
					t_skip=true;
					break;
				}
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<246>");
			c_Enumerator* t_4=m_finish_stack->p_ObjectEnumerator();
			while(t_4->p_HasNext()){
				DBG_BLOCK();
				c_PixmapStack* t_ss2=t_4->p_NextObject();
				DBG_LOCAL(t_ss2,"ss")
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<247>");
				if(t_ss2->m_file==t_f){
					DBG_BLOCK();
					t_skip=true;
					break;
				}
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<250>");
			if(t_skip!=true){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<251>");
				m_total+=1;
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<252>");
				m_start_stack->p_Insert2(0,(new c_PixmapStack)->m_new(t_f,bb_data_FixDataPath(t_f),m_total));
			}
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<257>");
		gc_assign(m_old_file,t_file);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<263>");
	if(!m_start_stack->p_IsEmpty()){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<265>");
		m_loading=true;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<268>");
		c_PixmapStack* t_f2=0;
		DBG_LOCAL(t_f2,"f")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<270>");
		c_BackwardsEnumerator* t_5=m_start_stack->p_Backwards()->p_ObjectEnumerator();
		while(t_5->p_HasNext()){
			DBG_BLOCK();
			t_f2=t_5->p_NextObject();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<272>");
			if(t_f2->m_loading==false){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<274>");
				m_manager->p_PreLoadData(t_f2->m_file,t_f2->m_id);
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<275>");
				t_f2->m_loading=true;
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<276>");
				break;
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<279>");
				if(m_manager->p_IsLoaded(t_f2->m_id)){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<281>");
					m_start_stack->p_RemoveEach(t_f2);
					DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<282>");
					m_finish_stack->p_Push4(t_f2);
				}
			}
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<293>");
	int t_6=p_CheckAllLoaded();
	return t_6;
}
void c_TPixmapPreloader::p_RemoveFromStack(String t_file){
	DBG_ENTER("TPixmapPreloader.RemoveFromStack")
	c_TPixmapPreloader *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_file,"file")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<323>");
	if(!m_finish_stack->p_IsEmpty()){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<325>");
		int t_j=0;
		DBG_LOCAL(t_j,"j")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<326>");
		c_Enumerator* t_=m_finish_stack->p_ObjectEnumerator();
		while(t_->p_HasNext()){
			DBG_BLOCK();
			c_PixmapStack* t_i=t_->p_NextObject();
			DBG_LOCAL(t_i,"i")
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<328>");
			t_j=t_j+1;
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<329>");
			if(t_i->m_file==t_file || t_i->m_new_file==t_file){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<330>");
				m_finish_stack->p_Remove2(t_j);
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<331>");
				break;
			}
		}
	}
}
c_TPixmapPreloader* c_TPixmapPreloader::m_new(c_IPreloadManager* t_m){
	DBG_ENTER("TPixmapPreloader.new")
	c_TPixmapPreloader *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_m,"m")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<197>");
	gc_assign(m_manager,t_m);
	return this;
}
c_TPixmapPreloader* c_TPixmapPreloader::m_new2(){
	DBG_ENTER("TPixmapPreloader.new")
	c_TPixmapPreloader *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<183>");
	return this;
}
int c_TPixmapPreloader::p_GetID(String t_file){
	DBG_ENTER("TPixmapPreloader.GetID")
	c_TPixmapPreloader *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_file,"file")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<307>");
	if(!m_finish_stack->p_IsEmpty()){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<309>");
		c_Enumerator* t_=m_finish_stack->p_ObjectEnumerator();
		while(t_->p_HasNext()){
			DBG_BLOCK();
			c_PixmapStack* t_i=t_->p_NextObject();
			DBG_LOCAL(t_i,"i")
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<311>");
			if(t_i->m_file==t_file || t_i->m_new_file==t_file){
				DBG_BLOCK();
				return t_i->m_id;
			}
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<317>");
	return 0;
}
void c_TPixmapPreloader::p_GetPixmapPreLoad(c_TPixmap* t_p,String t_file){
	DBG_ENTER("TPixmapPreloader.GetPixmapPreLoad")
	c_TPixmapPreloader *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_p,"p")
	DBG_LOCAL(t_file,"file")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<299>");
	int t_id=p_GetID(t_file);
	DBG_LOCAL(t_id,"id")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<300>");
	m_manager->p_SetPixmapFromID(t_p,t_id,t_file);
}
void c_TPixmapPreloader::mark(){
	Object::mark();
	gc_mark_q(m_manager);
	gc_mark_q(m_old_file);
	gc_mark_q(m_start_stack);
	gc_mark_q(m_finish_stack);
}
String c_TPixmapPreloader::debug(){
	String t="(TPixmapPreloader)\n";
	t+=dbg_decl("manager",&m_manager);
	t+=dbg_decl("loading",&m_loading);
	t+=dbg_decl("total",&m_total);
	t+=dbg_decl("old_file",&m_old_file);
	t+=dbg_decl("start_stack",&m_start_stack);
	t+=dbg_decl("finish_stack",&m_finish_stack);
	return t;
}
c_PixmapStack::c_PixmapStack(){
	m_file=String();
	m_new_file=String();
	m_id=0;
	m_loading=false;
}
c_PixmapStack* c_PixmapStack::m_new(String t_f,String t_nf,int t_i){
	DBG_ENTER("PixmapStack.new")
	c_PixmapStack *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_f,"f")
	DBG_LOCAL(t_nf,"nf")
	DBG_LOCAL(t_i,"i")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<349>");
	m_file=t_f;
	m_new_file=t_nf;
	m_id=t_i;
	return this;
}
c_PixmapStack* c_PixmapStack::m_new2(){
	DBG_ENTER("PixmapStack.new")
	c_PixmapStack *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tpixmap.monkey<342>");
	return this;
}
void c_PixmapStack::mark(){
	Object::mark();
}
String c_PixmapStack::debug(){
	String t="(PixmapStack)\n";
	t+=dbg_decl("file",&m_file);
	t+=dbg_decl("new_file",&m_new_file);
	t+=dbg_decl("id",&m_id);
	t+=dbg_decl("loading",&m_loading);
	return t;
}
c_Stack2::c_Stack2(){
	m_data=Array<c_PixmapStack* >();
	m_length=0;
}
c_Stack2* c_Stack2::m_new(){
	DBG_ENTER("Stack.new")
	c_Stack2 *self=this;
	DBG_LOCAL(self,"Self")
	return this;
}
c_Stack2* c_Stack2::m_new2(Array<c_PixmapStack* > t_data){
	DBG_ENTER("Stack.new")
	c_Stack2 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<13>");
	gc_assign(this->m_data,t_data.Slice(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<14>");
	this->m_length=t_data.Length();
	return this;
}
c_Enumerator* c_Stack2::p_ObjectEnumerator(){
	DBG_ENTER("Stack.ObjectEnumerator")
	c_Stack2 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<184>");
	c_Enumerator* t_=(new c_Enumerator)->m_new(this);
	return t_;
}
c_PixmapStack* c_Stack2::m_NIL;
void c_Stack2::p_Length(int t_newlength){
	DBG_ENTER("Stack.Length")
	c_Stack2 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_newlength,"newlength")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<41>");
	if(t_newlength<m_length){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<42>");
		for(int t_i=t_newlength;t_i<m_length;t_i=t_i+1){
			DBG_BLOCK();
			DBG_LOCAL(t_i,"i")
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<43>");
			gc_assign(m_data.At(t_i),m_NIL);
		}
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<45>");
		if(t_newlength>m_data.Length()){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<46>");
			gc_assign(m_data,m_data.Resize(bb_math2_Max(m_length*2+10,t_newlength)));
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<48>");
	m_length=t_newlength;
}
int c_Stack2::p_Length2(){
	DBG_ENTER("Stack.Length")
	c_Stack2 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<52>");
	return m_length;
}
void c_Stack2::p_Insert2(int t_index,c_PixmapStack* t_value){
	DBG_ENTER("Stack.Insert")
	c_Stack2 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_index,"index")
	DBG_LOCAL(t_value,"value")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<122>");
	if(m_length==m_data.Length()){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<123>");
		gc_assign(m_data,m_data.Resize(m_length*2+10));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<125>");
	for(int t_i=m_length;t_i>t_index;t_i=t_i+-1){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<126>");
		gc_assign(m_data.At(t_i),m_data.At(t_i-1));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<128>");
	gc_assign(m_data.At(t_index),t_value);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<129>");
	m_length+=1;
}
bool c_Stack2::p_IsEmpty(){
	DBG_ENTER("Stack.IsEmpty")
	c_Stack2 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<56>");
	bool t_=m_length==0;
	return t_;
}
c_BackwardsStack* c_Stack2::p_Backwards(){
	DBG_ENTER("Stack.Backwards")
	c_Stack2 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<188>");
	c_BackwardsStack* t_=(new c_BackwardsStack)->m_new(this);
	return t_;
}
bool c_Stack2::p_Equals(c_PixmapStack* t_lhs,c_PixmapStack* t_rhs){
	DBG_ENTER("Stack.Equals")
	c_Stack2 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_lhs,"lhs")
	DBG_LOCAL(t_rhs,"rhs")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<26>");
	bool t_=t_lhs==t_rhs;
	return t_;
}
void c_Stack2::p_RemoveEach(c_PixmapStack* t_value){
	DBG_ENTER("Stack.RemoveEach")
	c_Stack2 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_value,"value")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<151>");
	int t_i=0;
	int t_j=m_length;
	DBG_LOCAL(t_i,"i")
	DBG_LOCAL(t_j,"j")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<152>");
	while(t_i<m_length){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<153>");
		if(!p_Equals(m_data.At(t_i),t_value)){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<154>");
			t_i+=1;
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<155>");
			continue;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<157>");
		int t_b=t_i;
		int t_e=t_i+1;
		DBG_LOCAL(t_b,"b")
		DBG_LOCAL(t_e,"e")
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<158>");
		while(t_e<m_length && p_Equals(m_data.At(t_e),t_value)){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<159>");
			t_e+=1;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<161>");
		while(t_e<m_length){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<162>");
			gc_assign(m_data.At(t_b),m_data.At(t_e));
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<163>");
			t_b+=1;
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<164>");
			t_e+=1;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<166>");
		m_length-=t_e-t_b;
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<167>");
		t_i+=1;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<169>");
	t_i=m_length;
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<170>");
	while(t_i<t_j){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<171>");
		gc_assign(m_data.At(t_i),m_NIL);
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<172>");
		t_i+=1;
	}
}
void c_Stack2::p_Push4(c_PixmapStack* t_value){
	DBG_ENTER("Stack.Push")
	c_Stack2 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_value,"value")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<67>");
	if(m_length==m_data.Length()){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<68>");
		gc_assign(m_data,m_data.Resize(m_length*2+10));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<70>");
	gc_assign(m_data.At(m_length),t_value);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<71>");
	m_length+=1;
}
void c_Stack2::p_Push5(Array<c_PixmapStack* > t_values,int t_offset,int t_count){
	DBG_ENTER("Stack.Push")
	c_Stack2 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_values,"values")
	DBG_LOCAL(t_offset,"offset")
	DBG_LOCAL(t_count,"count")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<79>");
	for(int t_i=0;t_i<t_count;t_i=t_i+1){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<80>");
		p_Push4(t_values.At(t_offset+t_i));
	}
}
void c_Stack2::p_Push6(Array<c_PixmapStack* > t_values,int t_offset){
	DBG_ENTER("Stack.Push")
	c_Stack2 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_values,"values")
	DBG_LOCAL(t_offset,"offset")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<75>");
	p_Push5(t_values,t_offset,t_values.Length()-t_offset);
}
void c_Stack2::p_Remove2(int t_index){
	DBG_ENTER("Stack.Remove")
	c_Stack2 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_index,"index")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<133>");
	for(int t_i=t_index;t_i<m_length-1;t_i=t_i+1){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<134>");
		gc_assign(m_data.At(t_i),m_data.At(t_i+1));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<136>");
	m_length-=1;
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<137>");
	gc_assign(m_data.At(m_length),m_NIL);
}
void c_Stack2::mark(){
	Object::mark();
	gc_mark_q(m_data);
}
String c_Stack2::debug(){
	String t="(Stack)\n";
	t+=dbg_decl("NIL",&c_Stack2::m_NIL);
	t+=dbg_decl("data",&m_data);
	t+=dbg_decl("length",&m_length);
	return t;
}
c_Enumerator::c_Enumerator(){
	m_stack=0;
	m_index=0;
}
c_Enumerator* c_Enumerator::m_new(c_Stack2* t_stack){
	DBG_ENTER("Enumerator.new")
	c_Enumerator *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_stack,"stack")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<255>");
	gc_assign(this->m_stack,t_stack);
	return this;
}
c_Enumerator* c_Enumerator::m_new2(){
	DBG_ENTER("Enumerator.new")
	c_Enumerator *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<252>");
	return this;
}
bool c_Enumerator::p_HasNext(){
	DBG_ENTER("Enumerator.HasNext")
	c_Enumerator *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<259>");
	bool t_=m_index<m_stack->p_Length2();
	return t_;
}
c_PixmapStack* c_Enumerator::p_NextObject(){
	DBG_ENTER("Enumerator.NextObject")
	c_Enumerator *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<263>");
	m_index+=1;
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<264>");
	c_PixmapStack* t_=m_stack->m_data.At(m_index-1);
	return t_;
}
void c_Enumerator::mark(){
	Object::mark();
	gc_mark_q(m_stack);
}
String c_Enumerator::debug(){
	String t="(Enumerator)\n";
	t+=dbg_decl("stack",&m_stack);
	t+=dbg_decl("index",&m_index);
	return t;
}
int bb_math2_Max(int t_x,int t_y){
	DBG_ENTER("Max")
	DBG_LOCAL(t_x,"x")
	DBG_LOCAL(t_y,"y")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/math.monkey<56>");
	if(t_x>t_y){
		DBG_BLOCK();
		return t_x;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/math.monkey<57>");
	return t_y;
}
Float bb_math2_Max2(Float t_x,Float t_y){
	DBG_ENTER("Max")
	DBG_LOCAL(t_x,"x")
	DBG_LOCAL(t_y,"y")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/math.monkey<83>");
	if(t_x>t_y){
		DBG_BLOCK();
		return t_x;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/math.monkey<84>");
	return t_y;
}
c_BackwardsStack::c_BackwardsStack(){
	m_stack=0;
}
c_BackwardsStack* c_BackwardsStack::m_new(c_Stack2* t_stack){
	DBG_ENTER("BackwardsStack.new")
	c_BackwardsStack *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_stack,"stack")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<277>");
	gc_assign(this->m_stack,t_stack);
	return this;
}
c_BackwardsStack* c_BackwardsStack::m_new2(){
	DBG_ENTER("BackwardsStack.new")
	c_BackwardsStack *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<274>");
	return this;
}
c_BackwardsEnumerator* c_BackwardsStack::p_ObjectEnumerator(){
	DBG_ENTER("BackwardsStack.ObjectEnumerator")
	c_BackwardsStack *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<281>");
	c_BackwardsEnumerator* t_=(new c_BackwardsEnumerator)->m_new(m_stack);
	return t_;
}
void c_BackwardsStack::mark(){
	Object::mark();
	gc_mark_q(m_stack);
}
String c_BackwardsStack::debug(){
	String t="(BackwardsStack)\n";
	t+=dbg_decl("stack",&m_stack);
	return t;
}
c_BackwardsEnumerator::c_BackwardsEnumerator(){
	m_stack=0;
	m_index=0;
}
c_BackwardsEnumerator* c_BackwardsEnumerator::m_new(c_Stack2* t_stack){
	DBG_ENTER("BackwardsEnumerator.new")
	c_BackwardsEnumerator *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_stack,"stack")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<293>");
	gc_assign(this->m_stack,t_stack);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<294>");
	m_index=t_stack->m_length;
	return this;
}
c_BackwardsEnumerator* c_BackwardsEnumerator::m_new2(){
	DBG_ENTER("BackwardsEnumerator.new")
	c_BackwardsEnumerator *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<290>");
	return this;
}
bool c_BackwardsEnumerator::p_HasNext(){
	DBG_ENTER("BackwardsEnumerator.HasNext")
	c_BackwardsEnumerator *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<298>");
	bool t_=m_index>0;
	return t_;
}
c_PixmapStack* c_BackwardsEnumerator::p_NextObject(){
	DBG_ENTER("BackwardsEnumerator.NextObject")
	c_BackwardsEnumerator *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<302>");
	m_index-=1;
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<303>");
	return m_stack->m_data.At(m_index);
}
void c_BackwardsEnumerator::mark(){
	Object::mark();
	gc_mark_q(m_stack);
}
String c_BackwardsEnumerator::debug(){
	String t="(BackwardsEnumerator)\n";
	t+=dbg_decl("stack",&m_stack);
	t+=dbg_decl("index",&m_index);
	return t;
}
int bb_functions_PreLoadPixmap(Array<String > t_fs){
	DBG_ENTER("PreLoadPixmap")
	DBG_LOCAL(t_fs,"fs")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/functions.monkey<1104>");
	int t_=c_TPixmap::m_PreLoadPixmap(t_fs);
	return t_;
}
int bb_functions_PreLoadPixmap2(String t_fs){
	DBG_ENTER("PreLoadPixmap")
	DBG_LOCAL(t_fs,"fs")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/functions.monkey<1108>");
	String t_2[]={t_fs};
	int t_=c_TPixmap::m_PreLoadPixmap(Array<String >(t_2,1));
	return t_;
}
void bb_mojographics_SetMojoEmulation(){
	DBG_ENTER("SetMojoEmulation")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<30>");
	c_MojoEmulationDevice::m_SetDevice();
}
int bb_opengles11_SetRender(int t_flags){
	DBG_ENTER("SetRender")
	DBG_LOCAL(t_flags,"flags")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<71>");
	gc_assign(c_TRender::m_render,((new c_OpenglES11)->m_new()));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<72>");
	c_TRender::m_render->p_GraphicsInit(t_flags);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/opengles11.monkey<73>");
	bb_mojographics_SetMojoEmulation();
	return 0;
}
c_List4::c_List4(){
	m__head=((new c_HeadNode4)->m_new());
}
c_List4* c_List4::m_new(){
	DBG_ENTER("List.new")
	c_List4 *self=this;
	DBG_LOCAL(self,"Self")
	return this;
}
c_Node5* c_List4::p_AddLast4(String t_data){
	DBG_ENTER("List.AddLast")
	c_List4 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<108>");
	c_Node5* t_=(new c_Node5)->m_new(m__head,m__head->m__pred,t_data);
	return t_;
}
c_List4* c_List4::m_new2(Array<String > t_data){
	DBG_ENTER("List.new")
	c_List4 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<13>");
	Array<String > t_=t_data;
	int t_2=0;
	while(t_2<t_.Length()){
		DBG_BLOCK();
		String t_t=t_.At(t_2);
		t_2=t_2+1;
		DBG_LOCAL(t_t,"t")
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<14>");
		p_AddLast4(t_t);
	}
	return this;
}
int c_List4::p_Count(){
	DBG_ENTER("List.Count")
	c_List4 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<41>");
	int t_n=0;
	c_Node5* t_node=m__head->m__succ;
	DBG_LOCAL(t_n,"n")
	DBG_LOCAL(t_node,"node")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<42>");
	while(t_node!=m__head){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<43>");
		t_node=t_node->m__succ;
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<44>");
		t_n+=1;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<46>");
	return t_n;
}
c_Enumerator2* c_List4::p_ObjectEnumerator(){
	DBG_ENTER("List.ObjectEnumerator")
	c_List4 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<186>");
	c_Enumerator2* t_=(new c_Enumerator2)->m_new(this);
	return t_;
}
Array<String > c_List4::p_ToArray(){
	DBG_ENTER("List.ToArray")
	c_List4 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<19>");
	Array<String > t_arr=Array<String >(p_Count());
	int t_i=0;
	DBG_LOCAL(t_arr,"arr")
	DBG_LOCAL(t_i,"i")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<20>");
	c_Enumerator2* t_=this->p_ObjectEnumerator();
	while(t_->p_HasNext()){
		DBG_BLOCK();
		String t_t=t_->p_NextObject();
		DBG_LOCAL(t_t,"t")
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<21>");
		t_arr.At(t_i)=t_t;
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<22>");
		t_i+=1;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<24>");
	return t_arr;
}
void c_List4::mark(){
	Object::mark();
	gc_mark_q(m__head);
}
String c_List4::debug(){
	String t="(List)\n";
	t+=dbg_decl("_head",&m__head);
	return t;
}
c_StringList::c_StringList(){
}
c_StringList* c_StringList::m_new(Array<String > t_data){
	DBG_ENTER("StringList.new")
	c_StringList *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<431>");
	c_List4::m_new2(t_data);
	return this;
}
c_StringList* c_StringList::m_new2(){
	DBG_ENTER("StringList.new")
	c_StringList *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<428>");
	c_List4::m_new();
	return this;
}
void c_StringList::mark(){
	c_List4::mark();
}
String c_StringList::debug(){
	String t="(StringList)\n";
	t=c_List4::debug()+t;
	return t;
}
c_Node5::c_Node5(){
	m__succ=0;
	m__pred=0;
	m__data=String();
}
c_Node5* c_Node5::m_new(c_Node5* t_succ,c_Node5* t_pred,String t_data){
	DBG_ENTER("Node.new")
	c_Node5 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_succ,"succ")
	DBG_LOCAL(t_pred,"pred")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<261>");
	gc_assign(m__succ,t_succ);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<262>");
	gc_assign(m__pred,t_pred);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<263>");
	gc_assign(m__succ->m__pred,this);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<264>");
	gc_assign(m__pred->m__succ,this);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<265>");
	m__data=t_data;
	return this;
}
c_Node5* c_Node5::m_new2(){
	DBG_ENTER("Node.new")
	c_Node5 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<258>");
	return this;
}
void c_Node5::mark(){
	Object::mark();
	gc_mark_q(m__succ);
	gc_mark_q(m__pred);
}
String c_Node5::debug(){
	String t="(Node)\n";
	t+=dbg_decl("_succ",&m__succ);
	t+=dbg_decl("_pred",&m__pred);
	t+=dbg_decl("_data",&m__data);
	return t;
}
c_HeadNode4::c_HeadNode4(){
}
c_HeadNode4* c_HeadNode4::m_new(){
	DBG_ENTER("HeadNode.new")
	c_HeadNode4 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<310>");
	c_Node5::m_new2();
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<311>");
	gc_assign(m__succ,(this));
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<312>");
	gc_assign(m__pred,(this));
	return this;
}
void c_HeadNode4::mark(){
	c_Node5::mark();
}
String c_HeadNode4::debug(){
	String t="(HeadNode)\n";
	t=c_Node5::debug()+t;
	return t;
}
c_Enumerator2::c_Enumerator2(){
	m__list=0;
	m__curr=0;
}
c_Enumerator2* c_Enumerator2::m_new(c_List4* t_list){
	DBG_ENTER("Enumerator.new")
	c_Enumerator2 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_list,"list")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<326>");
	gc_assign(m__list,t_list);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<327>");
	gc_assign(m__curr,t_list->m__head->m__succ);
	return this;
}
c_Enumerator2* c_Enumerator2::m_new2(){
	DBG_ENTER("Enumerator.new")
	c_Enumerator2 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<323>");
	return this;
}
bool c_Enumerator2::p_HasNext(){
	DBG_ENTER("Enumerator.HasNext")
	c_Enumerator2 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<331>");
	while(m__curr->m__succ->m__pred!=m__curr){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<332>");
		gc_assign(m__curr,m__curr->m__succ);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<334>");
	bool t_=m__curr!=m__list->m__head;
	return t_;
}
String c_Enumerator2::p_NextObject(){
	DBG_ENTER("Enumerator.NextObject")
	c_Enumerator2 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<338>");
	String t_data=m__curr->m__data;
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<339>");
	gc_assign(m__curr,m__curr->m__succ);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<340>");
	return t_data;
}
void c_Enumerator2::mark(){
	Object::mark();
	gc_mark_q(m__list);
	gc_mark_q(m__curr);
}
String c_Enumerator2::debug(){
	String t="(Enumerator)\n";
	t+=dbg_decl("_list",&m__list);
	t+=dbg_decl("_curr",&m__curr);
	return t;
}
int bb_app2_Millisecs(){
	DBG_ENTER("Millisecs")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/app.monkey<233>");
	int t_=bb_app2__game->Millisecs();
	return t_;
}
c_Stack3::c_Stack3(){
	m_data=Array<c_TTexture* >();
	m_length=0;
}
c_Stack3* c_Stack3::m_new(){
	DBG_ENTER("Stack.new")
	c_Stack3 *self=this;
	DBG_LOCAL(self,"Self")
	return this;
}
c_Stack3* c_Stack3::m_new2(Array<c_TTexture* > t_data){
	DBG_ENTER("Stack.new")
	c_Stack3 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<13>");
	gc_assign(this->m_data,t_data.Slice(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<14>");
	this->m_length=t_data.Length();
	return this;
}
c_TTexture* c_Stack3::m_NIL;
void c_Stack3::p_Length(int t_newlength){
	DBG_ENTER("Stack.Length")
	c_Stack3 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_newlength,"newlength")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<41>");
	if(t_newlength<m_length){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<42>");
		for(int t_i=t_newlength;t_i<m_length;t_i=t_i+1){
			DBG_BLOCK();
			DBG_LOCAL(t_i,"i")
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<43>");
			gc_assign(m_data.At(t_i),m_NIL);
		}
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<45>");
		if(t_newlength>m_data.Length()){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<46>");
			gc_assign(m_data,m_data.Resize(bb_math2_Max(m_length*2+10,t_newlength)));
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<48>");
	m_length=t_newlength;
}
int c_Stack3::p_Length2(){
	DBG_ENTER("Stack.Length")
	c_Stack3 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<52>");
	return m_length;
}
c_Enumerator3* c_Stack3::p_ObjectEnumerator(){
	DBG_ENTER("Stack.ObjectEnumerator")
	c_Stack3 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<184>");
	c_Enumerator3* t_=(new c_Enumerator3)->m_new(this);
	return t_;
}
void c_Stack3::p_Clear(){
	DBG_ENTER("Stack.Clear")
	c_Stack3 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<34>");
	for(int t_i=0;t_i<m_length;t_i=t_i+1){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<35>");
		gc_assign(m_data.At(t_i),m_NIL);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<37>");
	m_length=0;
}
void c_Stack3::p_Push7(c_TTexture* t_value){
	DBG_ENTER("Stack.Push")
	c_Stack3 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_value,"value")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<67>");
	if(m_length==m_data.Length()){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<68>");
		gc_assign(m_data,m_data.Resize(m_length*2+10));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<70>");
	gc_assign(m_data.At(m_length),t_value);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<71>");
	m_length+=1;
}
void c_Stack3::p_Push8(Array<c_TTexture* > t_values,int t_offset,int t_count){
	DBG_ENTER("Stack.Push")
	c_Stack3 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_values,"values")
	DBG_LOCAL(t_offset,"offset")
	DBG_LOCAL(t_count,"count")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<79>");
	for(int t_i=0;t_i<t_count;t_i=t_i+1){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<80>");
		p_Push7(t_values.At(t_offset+t_i));
	}
}
void c_Stack3::p_Push9(Array<c_TTexture* > t_values,int t_offset){
	DBG_ENTER("Stack.Push")
	c_Stack3 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_values,"values")
	DBG_LOCAL(t_offset,"offset")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<75>");
	p_Push8(t_values,t_offset,t_values.Length()-t_offset);
}
void c_Stack3::mark(){
	Object::mark();
	gc_mark_q(m_data);
}
String c_Stack3::debug(){
	String t="(Stack)\n";
	t+=dbg_decl("NIL",&c_Stack3::m_NIL);
	t+=dbg_decl("data",&m_data);
	t+=dbg_decl("length",&m_length);
	return t;
}
c_TextureStack::c_TextureStack(){
}
c_TextureStack* c_TextureStack::m_new(){
	DBG_ENTER("TextureStack.new")
	c_TextureStack *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<37>");
	c_Stack3::m_new();
	return this;
}
void c_TextureStack::mark(){
	c_Stack3::mark();
}
String c_TextureStack::debug(){
	String t="(TextureStack)\n";
	t=c_Stack3::debug()+t;
	return t;
}
c_Enumerator3::c_Enumerator3(){
	m_stack=0;
	m_index=0;
}
c_Enumerator3* c_Enumerator3::m_new(c_Stack3* t_stack){
	DBG_ENTER("Enumerator.new")
	c_Enumerator3 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_stack,"stack")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<255>");
	gc_assign(this->m_stack,t_stack);
	return this;
}
c_Enumerator3* c_Enumerator3::m_new2(){
	DBG_ENTER("Enumerator.new")
	c_Enumerator3 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<252>");
	return this;
}
bool c_Enumerator3::p_HasNext(){
	DBG_ENTER("Enumerator.HasNext")
	c_Enumerator3 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<259>");
	bool t_=m_index<m_stack->p_Length2();
	return t_;
}
c_TTexture* c_Enumerator3::p_NextObject(){
	DBG_ENTER("Enumerator.NextObject")
	c_Enumerator3 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<263>");
	m_index+=1;
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<264>");
	c_TTexture* t_=m_stack->m_data.At(m_index-1);
	return t_;
}
void c_Enumerator3::mark(){
	Object::mark();
	gc_mark_q(m_stack);
}
String c_Enumerator3::debug(){
	String t="(Enumerator)\n";
	t+=dbg_decl("stack",&m_stack);
	t+=dbg_decl("index",&m_index);
	return t;
}
c_Node6::c_Node6(){
	m__succ=0;
	m__pred=0;
	m__data=0;
}
int c_Node6::p_Remove(){
	DBG_ENTER("Node.Remove")
	c_Node6 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<274>");
	if(m__succ->m__pred!=this){
		DBG_BLOCK();
		bbError(String(L"Illegal operation on removed node",33));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<276>");
	gc_assign(m__succ->m__pred,m__pred);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<277>");
	gc_assign(m__pred->m__succ,m__succ);
	return 0;
}
c_Node6* c_Node6::m_new(c_Node6* t_succ,c_Node6* t_pred,c_TTexture* t_data){
	DBG_ENTER("Node.new")
	c_Node6 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_succ,"succ")
	DBG_LOCAL(t_pred,"pred")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<261>");
	gc_assign(m__succ,t_succ);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<262>");
	gc_assign(m__pred,t_pred);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<263>");
	gc_assign(m__succ->m__pred,this);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<264>");
	gc_assign(m__pred->m__succ,this);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<265>");
	gc_assign(m__data,t_data);
	return this;
}
c_Node6* c_Node6::m_new2(){
	DBG_ENTER("Node.new")
	c_Node6 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<258>");
	return this;
}
void c_Node6::mark(){
	Object::mark();
	gc_mark_q(m__succ);
	gc_mark_q(m__pred);
	gc_mark_q(m__data);
}
String c_Node6::debug(){
	String t="(Node)\n";
	t+=dbg_decl("_succ",&m__succ);
	t+=dbg_decl("_pred",&m__pred);
	t+=dbg_decl("_data",&m__data);
	return t;
}
c_TCamera::c_TCamera(){
	m_fov_y=FLOAT(.0);
	m_range_near=FLOAT(1.0);
	m_range_far=FLOAT(1000.0);
	m_aspect=FLOAT(.0);
	m_viewport=Array<int >(4);
	m_eyedx=FLOAT(0.0);
	m_focus=FLOAT(1.0);
	m_eyedy=FLOAT(0.0);
	m_proj_mode=1;
	m_proj_mat=(new c_Matrix)->m_new();
	m_draw2D=0;
	m_oldw=0;
	m_vwidth=0;
	m_oldh=0;
	m_vheight=0;
	m_vx=0;
	m_vy=0;
	m_mod_mat=(new c_Matrix)->m_new();
	m_view_mat=(new c_Matrix)->m_new();
	m_projview_mat=(new c_Matrix)->m_new();
	m_frustum=Array<Array<Float > >();
	m_cls_color=true;
	m_cls_zbuffer=true;
	m_zoom=FLOAT(1.0);
	m_inv_zoom=FLOAT(1.0);
	m_cam_link=0;
	m_cls_r=FLOAT(0.0);
	m_cls_g=FLOAT(0.0);
	m_cls_b=FLOAT(0.0);
	m_fog_mode=0;
	m_fog_range_near=FLOAT(1.0);
	m_fog_range_far=FLOAT(1000.0);
	m_fog_r=FLOAT(.0);
	m_fog_g=FLOAT(.0);
	m_fog_b=FLOAT(.0);
}
c_EntityList2* c_TCamera::m_cam_list;
int c_TCamera::p_SetPixelCamera(){
	DBG_ENTER("TCamera.SetPixelCamera")
	c_TCamera *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<643>");
	if(((m_draw2D)!=0) && m_oldw==m_vwidth && m_oldh==m_vheight){
		DBG_BLOCK();
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<644>");
	m_oldw=m_vwidth;
	m_oldh=m_vheight;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<645>");
	m_draw2D=1;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<647>");
	if(m_name==String()){
		DBG_BLOCK();
		m_name=String(L"pixel",5);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<650>");
	Float t_left=Float(m_vx)-Float(m_vwidth)*FLOAT(0.5);
	DBG_LOCAL(t_left,"left")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<651>");
	Float t_right=Float(m_vwidth)+t_left;
	DBG_LOCAL(t_right,"right")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<652>");
	Float t_bottom=Float(m_vy)-Float(m_vheight)/FLOAT(2.0);
	DBG_LOCAL(t_bottom,"bottom")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<653>");
	Float t_top=Float(m_vheight)+t_bottom;
	DBG_LOCAL(t_top,"top")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<655>");
	Float t_near=FLOAT(1.0);
	DBG_LOCAL(t_near,"near")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<656>");
	Float t_far=FLOAT(2.0);
	DBG_LOCAL(t_far,"far")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<658>");
	Float t_tx=-(t_right+t_left)/(t_right-t_left);
	DBG_LOCAL(t_tx,"tx")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<659>");
	Float t_ty=-(t_top+t_bottom)/(t_top-t_bottom);
	DBG_LOCAL(t_ty,"ty")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<660>");
	Float t_tz=-(t_far+t_near)/(t_far-t_near);
	DBG_LOCAL(t_tz,"tz")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<663>");
	m_proj_mat->m_grid.At(0).At(0)=FLOAT(2.0)/(t_right-t_left);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<664>");
	m_proj_mat->m_grid.At(0).At(1)=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<665>");
	m_proj_mat->m_grid.At(0).At(2)=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<666>");
	m_proj_mat->m_grid.At(0).At(3)=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<668>");
	m_proj_mat->m_grid.At(1).At(0)=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<669>");
	m_proj_mat->m_grid.At(1).At(1)=FLOAT(2.0)/(t_top-t_bottom);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<670>");
	m_proj_mat->m_grid.At(1).At(2)=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<671>");
	m_proj_mat->m_grid.At(1).At(3)=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<673>");
	m_proj_mat->m_grid.At(2).At(0)=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<674>");
	m_proj_mat->m_grid.At(2).At(1)=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<675>");
	m_proj_mat->m_grid.At(2).At(2)=FLOAT(-2.0)/(t_far-t_near);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<676>");
	m_proj_mat->m_grid.At(2).At(3)=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<678>");
	m_proj_mat->m_grid.At(3).At(0)=t_tx-FLOAT(1.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<679>");
	m_proj_mat->m_grid.At(3).At(1)=t_ty+FLOAT(1.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<680>");
	m_proj_mat->m_grid.At(3).At(2)=t_tz;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<681>");
	m_proj_mat->m_grid.At(3).At(3)=FLOAT(1.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<685>");
	m_mod_mat->p_LoadIdentity();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<686>");
	m_mat->p_LoadIdentity();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<687>");
	gc_assign(m_view_mat,m_mod_mat);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<688>");
	m_projview_mat->p_Overwrite(m_proj_mat);
	return 0;
}
int c_TCamera::p_accFrustum(Float t_left_,Float t_right_,Float t_bottom,Float t_top,Float t_zNear,Float t_zFar,Float t_pixdx,Float t_pixdy){
	DBG_ENTER("TCamera.accFrustum")
	c_TCamera *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_left_,"left_")
	DBG_LOCAL(t_right_,"right_")
	DBG_LOCAL(t_bottom,"bottom")
	DBG_LOCAL(t_top,"top")
	DBG_LOCAL(t_zNear,"zNear")
	DBG_LOCAL(t_zFar,"zFar")
	DBG_LOCAL(t_pixdx,"pixdx")
	DBG_LOCAL(t_pixdy,"pixdy")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<488>");
	Float t_xwsize=FLOAT(.0);
	Float t_ywsize=FLOAT(.0);
	DBG_LOCAL(t_xwsize,"xwsize")
	DBG_LOCAL(t_ywsize,"ywsize")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<489>");
	Float t_dx=FLOAT(.0);
	Float t_dy=FLOAT(.0);
	DBG_LOCAL(t_dx,"dx")
	DBG_LOCAL(t_dy,"dy")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<491>");
	if(((t_pixdx)!=0) || ((t_pixdy)!=0)){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<492>");
		t_xwsize=t_right_-t_left_;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<493>");
		t_ywsize=t_top-t_bottom;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<494>");
		t_dx=-(t_pixdx*t_xwsize/Float(m_viewport.At(2))+m_eyedx*t_zNear/m_focus);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<495>");
		t_dy=-(t_pixdy*t_ywsize/Float(m_viewport.At(3))+m_eyedy*t_zNear/m_focus);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<499>");
	if(m_proj_mode==1){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<501>");
		if(m_name==String()){
			DBG_BLOCK();
			m_name=String(L"perspective",11);
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<504>");
		t_left_+=t_dx;
		t_right_+=t_dx;
		t_bottom+=t_dy;
		t_top+=t_dy;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<505>");
		m_proj_mat->m_grid.At(0).At(0)=FLOAT(2.0)*t_zNear/(t_right_-t_left_);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<506>");
		m_proj_mat->m_grid.At(1).At(0)=FLOAT(0.0);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<507>");
		m_proj_mat->m_grid.At(2).At(0)=(t_right_+t_left_)/(t_right_-t_left_);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<508>");
		m_proj_mat->m_grid.At(3).At(0)=FLOAT(0.0);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<510>");
		m_proj_mat->m_grid.At(0).At(1)=FLOAT(0.0);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<511>");
		m_proj_mat->m_grid.At(1).At(1)=FLOAT(2.0)*t_zNear/(t_top-t_bottom);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<512>");
		m_proj_mat->m_grid.At(2).At(1)=(t_top+t_bottom)/(t_top-t_bottom);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<513>");
		m_proj_mat->m_grid.At(3).At(1)=FLOAT(0.0);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<515>");
		m_proj_mat->m_grid.At(0).At(2)=FLOAT(0.0);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<516>");
		m_proj_mat->m_grid.At(1).At(2)=FLOAT(0.0);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<517>");
		m_proj_mat->m_grid.At(2).At(2)=-(t_zFar+t_zNear)/(t_zFar-t_zNear);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<518>");
		m_proj_mat->m_grid.At(3).At(2)=-(FLOAT(2.0)*t_zFar*t_zNear)/(t_zFar-t_zNear);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<520>");
		m_proj_mat->m_grid.At(0).At(3)=FLOAT(0.0);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<521>");
		m_proj_mat->m_grid.At(1).At(3)=FLOAT(0.0);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<522>");
		m_proj_mat->m_grid.At(2).At(3)=FLOAT(-1.0);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<523>");
		m_proj_mat->m_grid.At(3).At(3)=FLOAT(0.0);
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<525>");
		if(m_proj_mode==2){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<529>");
			if(m_name==String()){
				DBG_BLOCK();
				m_name=String(L"isometric",9);
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<531>");
			t_left_+=t_dx;
			t_right_+=t_dx;
			t_bottom+=t_dy;
			t_top+=t_dy;
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<532>");
			m_proj_mat->m_grid.At(0).At(0)=FLOAT(2.0)/(t_right_-t_left_);
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<533>");
			m_proj_mat->m_grid.At(0).At(1)=FLOAT(0.0);
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<534>");
			m_proj_mat->m_grid.At(0).At(2)=FLOAT(0.0);
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<535>");
			m_proj_mat->m_grid.At(0).At(3)=FLOAT(0.0);
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<537>");
			m_proj_mat->m_grid.At(1).At(0)=FLOAT(0.0);
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<538>");
			m_proj_mat->m_grid.At(1).At(1)=FLOAT(2.0)/(t_top-t_bottom);
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<539>");
			m_proj_mat->m_grid.At(1).At(2)=FLOAT(0.0);
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<540>");
			m_proj_mat->m_grid.At(1).At(3)=FLOAT(0.0);
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<542>");
			m_proj_mat->m_grid.At(2).At(0)=FLOAT(0.0);
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<543>");
			m_proj_mat->m_grid.At(2).At(1)=FLOAT(0.0);
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<544>");
			m_proj_mat->m_grid.At(2).At(2)=FLOAT(-2.0)/(t_zFar-t_zNear);
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<545>");
			m_proj_mat->m_grid.At(2).At(3)=FLOAT(0.0);
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<547>");
			m_proj_mat->m_grid.At(3).At(0)=-(t_right_+t_left_)/(t_right_-t_left_);
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<548>");
			m_proj_mat->m_grid.At(3).At(1)=-(t_top+t_bottom)/(t_top-t_bottom);
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<549>");
			m_proj_mat->m_grid.At(3).At(2)=-(t_zFar+t_zNear)/(t_zFar-t_zNear);
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<550>");
			m_proj_mat->m_grid.At(3).At(3)=FLOAT(1.0);
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<552>");
			if(m_proj_mode==3){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<554>");
				p_SetPixelCamera();
			}
		}
	}
	return 0;
}
int c_TCamera::p_accPerspective(Float t_fovy,Float t_zNear,Float t_zFar,Float t_pixdx,Float t_pixdy){
	DBG_ENTER("TCamera.accPerspective")
	c_TCamera *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_fovy,"fovy")
	DBG_LOCAL(t_zNear,"zNear")
	DBG_LOCAL(t_zFar,"zFar")
	DBG_LOCAL(t_pixdx,"pixdx")
	DBG_LOCAL(t_pixdy,"pixdy")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<471>");
	Float t_fov2=FLOAT(.0);
	Float t_left_=FLOAT(.0);
	Float t_right_=FLOAT(.0);
	Float t_bottom=FLOAT(.0);
	Float t_top=FLOAT(.0);
	DBG_LOCAL(t_fov2,"fov2")
	DBG_LOCAL(t_left_,"left_")
	DBG_LOCAL(t_right_,"right_")
	DBG_LOCAL(t_bottom,"bottom")
	DBG_LOCAL(t_top,"top")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<473>");
	t_fov2=t_fovy*FLOAT(0.5);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<476>");
	t_top=t_zNear/((Float)cos((t_fov2)*D2R)/(Float)sin((t_fov2)*D2R));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<477>");
	t_bottom=-t_top;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<478>");
	t_right_=t_top*m_aspect;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<479>");
	t_left_=-t_right_;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<482>");
	p_accFrustum(t_left_,t_right_,t_bottom,t_top,t_zNear,t_zFar,t_pixdx,t_pixdy);
	return 0;
}
int c_TCamera::p_ExtractFrustum(){
	DBG_ENTER("TCamera.ExtractFrustum")
	c_TCamera *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<312>");
	Array<Float > t_clip=m_projview_mat->p_ToArray();
	DBG_LOCAL(t_clip,"clip")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<313>");
	Float t_t=FLOAT(.0);
	DBG_LOCAL(t_t,"t")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<319>");
	m_frustum.At(0).At(0)=t_clip.At(3)-t_clip.At(0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<320>");
	m_frustum.At(0).At(1)=t_clip.At(7)-t_clip.At(4);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<321>");
	m_frustum.At(0).At(2)=t_clip.At(11)-t_clip.At(8);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<322>");
	m_frustum.At(0).At(3)=t_clip.At(15)-t_clip.At(12);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<325>");
	t_t=FLOAT(1.0)/(Float)sqrt(m_frustum.At(0).At(0)*m_frustum.At(0).At(0)+m_frustum.At(0).At(1)*m_frustum.At(0).At(1)+m_frustum.At(0).At(2)*m_frustum.At(0).At(2));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<326>");
	m_frustum.At(0).At(0)*=t_t;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<327>");
	m_frustum.At(0).At(1)*=t_t;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<328>");
	m_frustum.At(0).At(2)*=t_t;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<329>");
	m_frustum.At(0).At(3)*=t_t;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<332>");
	m_frustum.At(1).At(0)=t_clip.At(3)+t_clip.At(0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<333>");
	m_frustum.At(1).At(1)=t_clip.At(7)+t_clip.At(4);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<334>");
	m_frustum.At(1).At(2)=t_clip.At(11)+t_clip.At(8);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<335>");
	m_frustum.At(1).At(3)=t_clip.At(15)+t_clip.At(12);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<338>");
	t_t=FLOAT(1.0)/(Float)sqrt(m_frustum.At(1).At(0)*m_frustum.At(1).At(0)+m_frustum.At(1).At(1)*m_frustum.At(1).At(1)+m_frustum.At(1).At(2)*m_frustum.At(1).At(2));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<339>");
	m_frustum.At(1).At(0)*=t_t;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<340>");
	m_frustum.At(1).At(1)*=t_t;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<341>");
	m_frustum.At(1).At(2)*=t_t;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<342>");
	m_frustum.At(1).At(3)*=t_t;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<345>");
	m_frustum.At(2).At(0)=t_clip.At(3)+t_clip.At(1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<346>");
	m_frustum.At(2).At(1)=t_clip.At(7)+t_clip.At(5);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<347>");
	m_frustum.At(2).At(2)=t_clip.At(11)+t_clip.At(9);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<348>");
	m_frustum.At(2).At(3)=t_clip.At(15)+t_clip.At(13);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<351>");
	t_t=FLOAT(1.0)/(Float)sqrt(m_frustum.At(2).At(0)*m_frustum.At(2).At(0)+m_frustum.At(2).At(1)*m_frustum.At(2).At(1)+m_frustum.At(2).At(2)*m_frustum.At(2).At(2));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<352>");
	m_frustum.At(2).At(0)*=t_t;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<353>");
	m_frustum.At(2).At(1)*=t_t;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<354>");
	m_frustum.At(2).At(2)*=t_t;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<355>");
	m_frustum.At(2).At(3)*=t_t;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<358>");
	m_frustum.At(3).At(0)=t_clip.At(3)-t_clip.At(1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<359>");
	m_frustum.At(3).At(1)=t_clip.At(7)-t_clip.At(5);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<360>");
	m_frustum.At(3).At(2)=t_clip.At(11)-t_clip.At(9);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<361>");
	m_frustum.At(3).At(3)=t_clip.At(15)-t_clip.At(13);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<364>");
	t_t=FLOAT(1.0)/(Float)sqrt(m_frustum.At(3).At(0)*m_frustum.At(3).At(0)+m_frustum.At(3).At(1)*m_frustum.At(3).At(1)+m_frustum.At(3).At(2)*m_frustum.At(3).At(2));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<365>");
	m_frustum.At(3).At(0)*=t_t;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<366>");
	m_frustum.At(3).At(1)*=t_t;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<367>");
	m_frustum.At(3).At(2)*=t_t;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<368>");
	m_frustum.At(3).At(3)*=t_t;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<371>");
	m_frustum.At(4).At(0)=t_clip.At(3)-t_clip.At(2);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<372>");
	m_frustum.At(4).At(1)=t_clip.At(7)-t_clip.At(6);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<373>");
	m_frustum.At(4).At(2)=t_clip.At(11)-t_clip.At(10);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<374>");
	m_frustum.At(4).At(3)=t_clip.At(15)-t_clip.At(14);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<377>");
	t_t=FLOAT(1.0)/(Float)sqrt(m_frustum.At(4).At(0)*m_frustum.At(4).At(0)+m_frustum.At(4).At(1)*m_frustum.At(4).At(1)+m_frustum.At(4).At(2)*m_frustum.At(4).At(2));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<378>");
	m_frustum.At(4).At(0)*=t_t;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<379>");
	m_frustum.At(4).At(1)*=t_t;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<380>");
	m_frustum.At(4).At(2)*=t_t;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<381>");
	m_frustum.At(4).At(3)*=t_t;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<384>");
	m_frustum.At(5).At(0)=t_clip.At(3)+t_clip.At(2);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<385>");
	m_frustum.At(5).At(1)=t_clip.At(7)+t_clip.At(6);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<386>");
	m_frustum.At(5).At(2)=t_clip.At(11)+t_clip.At(10);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<387>");
	m_frustum.At(5).At(3)=t_clip.At(15)+t_clip.At(14);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<390>");
	t_t=FLOAT(1.0)/(Float)sqrt(m_frustum.At(5).At(0)*m_frustum.At(5).At(0)+m_frustum.At(5).At(1)*m_frustum.At(5).At(1)+m_frustum.At(5).At(2)*m_frustum.At(5).At(2));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<391>");
	m_frustum.At(5).At(0)*=t_t;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<392>");
	m_frustum.At(5).At(1)*=t_t;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<393>");
	m_frustum.At(5).At(2)*=t_t;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<394>");
	m_frustum.At(5).At(3)*=t_t;
	return 0;
}
int c_TCamera::p_Update2(c_TCamera* t_cam){
	DBG_ENTER("TCamera.Update")
	c_TCamera *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_cam,"cam")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<455>");
	p_accPerspective(m_fov_y,m_range_near,m_range_far,FLOAT(0.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<458>");
	gc_assign(m_mod_mat,m_mat->p_Inverse());
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<459>");
	if(((m_eyedx)!=0) || ((m_eyedy)!=0)){
		DBG_BLOCK();
		m_mod_mat->p_Translate(-m_eyedx,-m_eyedy,FLOAT(0.0));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<461>");
	gc_assign(m_view_mat,m_mod_mat);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<462>");
	m_projview_mat->p_Overwrite(m_proj_mat);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<463>");
	m_projview_mat->p_Multiply4(m_mod_mat);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<465>");
	if((t_cam)!=0){
		DBG_BLOCK();
		p_ExtractFrustum();
	}
	return 0;
}
Float c_TCamera::p_EntityInFrustum(c_TEntity* t_ent){
	DBG_ENTER("TCamera.EntityInFrustum")
	c_TCamera *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_ent,"ent")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<400>");
	Float t_x=t_ent->p_EntityX(1);
	DBG_LOCAL(t_x,"x")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<401>");
	Float t_y=t_ent->p_EntityY(1);
	DBG_LOCAL(t_y,"y")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<402>");
	Float t_z=t_ent->p_EntityZ(1);
	DBG_LOCAL(t_z,"z")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<404>");
	Float t_radius=bb_math2_Abs2(t_ent->m_cull_radius);
	DBG_LOCAL(t_radius,"radius")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<407>");
	c_TMesh* t_mesh=dynamic_cast<c_TMesh*>(t_ent);
	DBG_LOCAL(t_mesh,"mesh")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<408>");
	if((t_mesh)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<411>");
		Array<Float > t_r=t_ent->m_mat->p_TransformPoint(t_mesh->m_center_x,t_mesh->m_center_y,t_mesh->m_center_z,FLOAT(1.0));
		DBG_LOCAL(t_r,"r")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<412>");
		t_x=t_r.At(0);
		t_y=t_r.At(1);
		t_z=t_r.At(2);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<416>");
		Float t_gs=bb_math2_Max2(bb_math2_Max2(t_ent->m_gsx,t_ent->m_gsy),t_ent->m_gsz);
		DBG_LOCAL(t_gs,"gs")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<417>");
		t_radius=t_radius*t_gs;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<418>");
		if(t_radius<FLOAT(0.0)){
			DBG_BLOCK();
			t_radius=-t_radius;
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<424>");
	Float t_d=FLOAT(.0);
	DBG_LOCAL(t_d,"d")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<427>");
	t_d=m_frustum.At(0).At(0)*t_x+m_frustum.At(0).At(1)*t_y+m_frustum.At(0).At(2)*t_z+m_frustum.At(0).At(3);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<428>");
	if(t_d<=-t_radius){
		DBG_BLOCK();
		return FLOAT(0.0);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<429>");
	t_d=m_frustum.At(1).At(0)*t_x+m_frustum.At(1).At(1)*t_y+m_frustum.At(1).At(2)*t_z+m_frustum.At(1).At(3);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<430>");
	if(t_d<=-t_radius){
		DBG_BLOCK();
		return FLOAT(0.0);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<431>");
	t_d=m_frustum.At(2).At(0)*t_x+m_frustum.At(2).At(1)*t_y+m_frustum.At(2).At(2)*t_z+m_frustum.At(2).At(3);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<432>");
	if(t_d<=-t_radius){
		DBG_BLOCK();
		return FLOAT(0.0);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<433>");
	t_d=m_frustum.At(3).At(0)*t_x+m_frustum.At(3).At(1)*t_y+m_frustum.At(3).At(2)*t_z+m_frustum.At(3).At(3);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<434>");
	if(t_d<=-t_radius){
		DBG_BLOCK();
		return FLOAT(0.0);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<435>");
	t_d=m_frustum.At(4).At(0)*t_x+m_frustum.At(4).At(1)*t_y+m_frustum.At(4).At(2)*t_z+m_frustum.At(4).At(3);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<436>");
	if(t_d<=-t_radius){
		DBG_BLOCK();
		return FLOAT(0.0);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<437>");
	t_d=m_frustum.At(5).At(0)*t_x+m_frustum.At(5).At(1)*t_y+m_frustum.At(5).At(2)*t_z+m_frustum.At(5).At(3);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<438>");
	if(t_d<=-t_radius){
		DBG_BLOCK();
		return FLOAT(0.0);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<441>");
	Float t_=t_d+t_radius;
	return t_;
}
c_TCamera* c_TCamera::m_new(){
	DBG_ENTER("TCamera.new")
	c_TCamera *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<57>");
	c_TEntity::m_new();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<59>");
	gc_assign(m_frustum,bb_monkeyutility_AllocateFloatArray(6,4));
	return this;
}
int c_TCamera::p_CameraClsMode(bool t_color,bool t_zbuffer){
	DBG_ENTER("TCamera.CameraClsMode")
	c_TCamera *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_color,"color")
	DBG_LOCAL(t_zbuffer,"zbuffer")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<191>");
	m_cls_color=t_color;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<192>");
	m_cls_zbuffer=t_zbuffer;
	return 0;
}
int c_TCamera::p_CameraZoom(Float t_zoom_val){
	DBG_ENTER("TCamera.CameraZoom")
	c_TCamera *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_zoom_val,"zoom_val")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<205>");
	m_zoom=t_zoom_val;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<206>");
	m_inv_zoom=FLOAT(1.0)/t_zoom_val;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<207>");
	m_fov_y=(Float)(atan(FLOAT(1.0)/(m_zoom*(Float(m_vwidth)/Float(m_vheight))))*R2D)*FLOAT(2.0);
	return 0;
}
int c_TCamera::p_CameraViewport(int t_x,int t_y,int t_w,int t_h){
	DBG_ENTER("TCamera.CameraViewport")
	c_TCamera *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_x,"x")
	DBG_LOCAL(t_y,"y")
	DBG_LOCAL(t_w,"w")
	DBG_LOCAL(t_h,"h")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<145>");
	m_vx=t_x;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<146>");
	m_vy=c_TRender::m_height-t_h-t_y;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<147>");
	m_vwidth=t_w;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<148>");
	m_vheight=t_h;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<150>");
	p_CameraZoom(m_zoom);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<151>");
	m_aspect=Float(m_vwidth)/Float(m_vheight);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<153>");
	m_viewport.At(0)=m_vx;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<154>");
	m_viewport.At(1)=m_vy;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<155>");
	m_viewport.At(2)=t_w;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<156>");
	m_viewport.At(3)=t_h;
	return 0;
}
c_TCamera* c_TCamera::m_CreateCamera(c_TEntity* t_parent_ent){
	DBG_ENTER("TCamera.CreateCamera")
	DBG_LOCAL(t_parent_ent,"parent_ent")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<120>");
	c_TCamera* t_cam=(new c_TCamera)->m_new();
	DBG_LOCAL(t_cam,"cam")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<122>");
	t_cam->p_CameraViewport(0,0,c_TRender::m_width,c_TRender::m_height);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<124>");
	t_cam->m_classname=String(L"Camera",6);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<125>");
	t_cam->m_name=String(L"proj",4)+String(m_cam_list->p_Count());
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<127>");
	t_cam->p_AddParent(t_parent_ent);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<128>");
	gc_assign(t_cam->m_entity_link,c_TEntity::m_entity_list->p_EntityListAdd(t_cam));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<129>");
	gc_assign(t_cam->m_cam_link,m_cam_list->p_EntityListAdd2(t_cam));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<132>");
	if(t_cam->m_parent!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<133>");
		t_cam->m_mat->p_Overwrite(t_cam->m_parent->m_mat);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<134>");
		t_cam->p_UpdateMat(false);
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<136>");
		t_cam->p_UpdateMat(true);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<139>");
	return t_cam;
}
int c_TCamera::p_CameraClsColor(Float t_r,Float t_g,Float t_b){
	DBG_ENTER("TCamera.CameraClsColor")
	c_TCamera *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_r,"r")
	DBG_LOCAL(t_g,"g")
	DBG_LOCAL(t_b,"b")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<183>");
	m_cls_r=t_r/FLOAT(255.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<184>");
	m_cls_g=t_g/FLOAT(255.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<185>");
	m_cls_b=t_b/FLOAT(255.0);
	return 0;
}
int c_TCamera::p_CameraScissor(int t_x,int t_y,int t_w,int t_h){
	DBG_ENTER("TCamera.CameraScissor")
	c_TCamera *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_x,"x")
	DBG_LOCAL(t_y,"y")
	DBG_LOCAL(t_w,"w")
	DBG_LOCAL(t_h,"h")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<162>");
	if(t_x<0){
		DBG_BLOCK();
		t_x=0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<163>");
	if(t_x>c_TRender::m_width){
		DBG_BLOCK();
		t_x=c_TRender::m_width;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<164>");
	if(t_y<0){
		DBG_BLOCK();
		t_y=0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<165>");
	if(t_y>c_TRender::m_height){
		DBG_BLOCK();
		t_y=c_TRender::m_height;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<167>");
	if(t_w<0){
		DBG_BLOCK();
		t_w=0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<168>");
	if(t_w>c_TRender::m_width){
		DBG_BLOCK();
		t_w=c_TRender::m_width;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<169>");
	if(t_h<0){
		DBG_BLOCK();
		t_h=0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<170>");
	if(t_h>c_TRender::m_height){
		DBG_BLOCK();
		t_h=c_TRender::m_height;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<172>");
	t_y=c_TRender::m_height-t_h-t_y;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<174>");
	m_viewport.At(0)=t_x;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<175>");
	m_viewport.At(1)=t_y;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<176>");
	m_viewport.At(2)=t_w;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tcamera.monkey<177>");
	m_viewport.At(3)=t_h;
	return 0;
}
void c_TCamera::mark(){
	c_TEntity::mark();
	gc_mark_q(m_viewport);
	gc_mark_q(m_proj_mat);
	gc_mark_q(m_mod_mat);
	gc_mark_q(m_view_mat);
	gc_mark_q(m_projview_mat);
	gc_mark_q(m_frustum);
	gc_mark_q(m_cam_link);
}
String c_TCamera::debug(){
	String t="(TCamera)\n";
	t=c_TEntity::debug()+t;
	t+=dbg_decl("cam_list",&c_TCamera::m_cam_list);
	t+=dbg_decl("cam_link",&m_cam_link);
	t+=dbg_decl("vx",&m_vx);
	t+=dbg_decl("vy",&m_vy);
	t+=dbg_decl("vwidth",&m_vwidth);
	t+=dbg_decl("vheight",&m_vheight);
	t+=dbg_decl("viewport",&m_viewport);
	t+=dbg_decl("cls_r",&m_cls_r);
	t+=dbg_decl("cls_g",&m_cls_g);
	t+=dbg_decl("cls_b",&m_cls_b);
	t+=dbg_decl("cls_color",&m_cls_color);
	t+=dbg_decl("cls_zbuffer",&m_cls_zbuffer);
	t+=dbg_decl("range_near",&m_range_near);
	t+=dbg_decl("range_far",&m_range_far);
	t+=dbg_decl("zoom",&m_zoom);
	t+=dbg_decl("inv_zoom",&m_inv_zoom);
	t+=dbg_decl("fov_y",&m_fov_y);
	t+=dbg_decl("aspect",&m_aspect);
	t+=dbg_decl("eyedx",&m_eyedx);
	t+=dbg_decl("eyedy",&m_eyedy);
	t+=dbg_decl("focus",&m_focus);
	t+=dbg_decl("proj_mode",&m_proj_mode);
	t+=dbg_decl("fog_mode",&m_fog_mode);
	t+=dbg_decl("fog_r",&m_fog_r);
	t+=dbg_decl("fog_g",&m_fog_g);
	t+=dbg_decl("fog_b",&m_fog_b);
	t+=dbg_decl("fog_range_near",&m_fog_range_near);
	t+=dbg_decl("fog_range_far",&m_fog_range_far);
	t+=dbg_decl("draw2D",&m_draw2D);
	t+=dbg_decl("mod_mat",&m_mod_mat);
	t+=dbg_decl("proj_mat",&m_proj_mat);
	t+=dbg_decl("projview_mat",&m_projview_mat);
	t+=dbg_decl("view_mat",&m_view_mat);
	t+=dbg_decl("frustum",&m_frustum);
	t+=dbg_decl("oldw",&m_oldw);
	t+=dbg_decl("oldh",&m_oldh);
	return t;
}
c_List5::c_List5(){
	m__head=((new c_HeadNode5)->m_new());
}
c_List5* c_List5::m_new(){
	DBG_ENTER("List.new")
	c_List5 *self=this;
	DBG_LOCAL(self,"Self")
	return this;
}
c_Node7* c_List5::p_AddLast5(c_TCamera* t_data){
	DBG_ENTER("List.AddLast")
	c_List5 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<108>");
	c_Node7* t_=(new c_Node7)->m_new(m__head,m__head->m__pred,t_data);
	return t_;
}
c_List5* c_List5::m_new2(Array<c_TCamera* > t_data){
	DBG_ENTER("List.new")
	c_List5 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<13>");
	Array<c_TCamera* > t_=t_data;
	int t_2=0;
	while(t_2<t_.Length()){
		DBG_BLOCK();
		c_TCamera* t_t=t_.At(t_2);
		t_2=t_2+1;
		DBG_LOCAL(t_t,"t")
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<14>");
		p_AddLast5(t_t);
	}
	return this;
}
c_Enumerator4* c_List5::p_ObjectEnumerator(){
	DBG_ENTER("List.ObjectEnumerator")
	c_List5 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<186>");
	c_Enumerator4* t_=(new c_Enumerator4)->m_new(this);
	return t_;
}
int c_List5::p_Count(){
	DBG_ENTER("List.Count")
	c_List5 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<41>");
	int t_n=0;
	c_Node7* t_node=m__head->m__succ;
	DBG_LOCAL(t_n,"n")
	DBG_LOCAL(t_node,"node")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<42>");
	while(t_node!=m__head){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<43>");
		t_node=t_node->m__succ;
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<44>");
		t_n+=1;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<46>");
	return t_n;
}
c_Node7* c_List5::p_FirstNode(){
	DBG_ENTER("List.FirstNode")
	c_List5 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<62>");
	if(m__head->m__succ!=m__head){
		DBG_BLOCK();
		return m__head->m__succ;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<63>");
	return 0;
}
c_Node7* c_List5::p_AddFirst2(c_TCamera* t_data){
	DBG_ENTER("List.AddFirst")
	c_List5 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<104>");
	c_Node7* t_=(new c_Node7)->m_new(m__head->m__succ,m__head,t_data);
	return t_;
}
void c_List5::mark(){
	Object::mark();
	gc_mark_q(m__head);
}
String c_List5::debug(){
	String t="(List)\n";
	t+=dbg_decl("_head",&m__head);
	return t;
}
c_EntityList2::c_EntityList2(){
}
c_EntityList2* c_EntityList2::m_new(){
	DBG_ENTER("EntityList.new")
	c_EntityList2 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2343>");
	c_List5::m_new();
	return this;
}
c_Node7* c_EntityList2::p_EntityListAdd2(c_TCamera* t_obj){
	DBG_ENTER("EntityList.EntityListAdd")
	c_EntityList2 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_obj,"obj")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2349>");
	c_Node7* t_llink=this->p_FirstNode();
	DBG_LOCAL(t_llink,"llink")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2351>");
	if(t_obj->m_order>0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2355>");
		t_llink=this->p_AddFirst2(t_obj);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2357>");
		return t_llink;
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2364>");
		t_llink=this->p_AddLast5(t_obj);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tentity.monkey<2366>");
		return t_llink;
	}
}
void c_EntityList2::mark(){
	c_List5::mark();
}
String c_EntityList2::debug(){
	String t="(EntityList)\n";
	t=c_List5::debug()+t;
	return t;
}
c_Node7::c_Node7(){
	m__succ=0;
	m__pred=0;
	m__data=0;
}
c_Node7* c_Node7::m_new(c_Node7* t_succ,c_Node7* t_pred,c_TCamera* t_data){
	DBG_ENTER("Node.new")
	c_Node7 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_succ,"succ")
	DBG_LOCAL(t_pred,"pred")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<261>");
	gc_assign(m__succ,t_succ);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<262>");
	gc_assign(m__pred,t_pred);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<263>");
	gc_assign(m__succ->m__pred,this);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<264>");
	gc_assign(m__pred->m__succ,this);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<265>");
	gc_assign(m__data,t_data);
	return this;
}
c_Node7* c_Node7::m_new2(){
	DBG_ENTER("Node.new")
	c_Node7 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<258>");
	return this;
}
void c_Node7::mark(){
	Object::mark();
	gc_mark_q(m__succ);
	gc_mark_q(m__pred);
	gc_mark_q(m__data);
}
String c_Node7::debug(){
	String t="(Node)\n";
	t+=dbg_decl("_succ",&m__succ);
	t+=dbg_decl("_pred",&m__pred);
	t+=dbg_decl("_data",&m__data);
	return t;
}
c_HeadNode5::c_HeadNode5(){
}
c_HeadNode5* c_HeadNode5::m_new(){
	DBG_ENTER("HeadNode.new")
	c_HeadNode5 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<310>");
	c_Node7::m_new2();
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<311>");
	gc_assign(m__succ,(this));
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<312>");
	gc_assign(m__pred,(this));
	return this;
}
void c_HeadNode5::mark(){
	c_Node7::mark();
}
String c_HeadNode5::debug(){
	String t="(HeadNode)\n";
	t=c_Node7::debug()+t;
	return t;
}
c_Enumerator4::c_Enumerator4(){
	m__list=0;
	m__curr=0;
}
c_Enumerator4* c_Enumerator4::m_new(c_List5* t_list){
	DBG_ENTER("Enumerator.new")
	c_Enumerator4 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_list,"list")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<326>");
	gc_assign(m__list,t_list);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<327>");
	gc_assign(m__curr,t_list->m__head->m__succ);
	return this;
}
c_Enumerator4* c_Enumerator4::m_new2(){
	DBG_ENTER("Enumerator.new")
	c_Enumerator4 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<323>");
	return this;
}
bool c_Enumerator4::p_HasNext(){
	DBG_ENTER("Enumerator.HasNext")
	c_Enumerator4 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<331>");
	while(m__curr->m__succ->m__pred!=m__curr){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<332>");
		gc_assign(m__curr,m__curr->m__succ);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<334>");
	bool t_=m__curr!=m__list->m__head;
	return t_;
}
c_TCamera* c_Enumerator4::p_NextObject(){
	DBG_ENTER("Enumerator.NextObject")
	c_Enumerator4 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<338>");
	c_TCamera* t_data=m__curr->m__data;
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<339>");
	gc_assign(m__curr,m__curr->m__succ);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<340>");
	return t_data;
}
void c_Enumerator4::mark(){
	Object::mark();
	gc_mark_q(m__list);
	gc_mark_q(m__curr);
}
String c_Enumerator4::debug(){
	String t="(Enumerator)\n";
	t+=dbg_decl("_list",&m__list);
	t+=dbg_decl("_curr",&m__curr);
	return t;
}
c_TShader::c_TShader(){
}
c_List6* c_TShader::m_process_list;
int c_TShader::m_PreProcess(c_TCamera* t_cam){
	DBG_ENTER("TShader.PreProcess")
	DBG_LOCAL(t_cam,"cam")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tshader.monkey<74>");
	c_Enumerator5* t_=m_process_list->p_ObjectEnumerator();
	while(t_->p_HasNext()){
		DBG_BLOCK();
		c_TShader* t_sh=t_->p_NextObject();
		DBG_LOCAL(t_sh,"sh")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tshader.monkey<75>");
		dynamic_cast<c_IShaderProcess*>(t_sh)->p_PreProcess(t_cam);
	}
	return 0;
}
c_TShader* c_TShader::m_g_shader;
int c_TShader::m_PostProcess(c_TCamera* t_cam){
	DBG_ENTER("TShader.PostProcess")
	DBG_LOCAL(t_cam,"cam")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tshader.monkey<82>");
	c_Enumerator5* t_=m_process_list->p_ObjectEnumerator();
	while(t_->p_HasNext()){
		DBG_BLOCK();
		c_TShader* t_sh=t_->p_NextObject();
		DBG_LOCAL(t_sh,"sh")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tshader.monkey<83>");
		dynamic_cast<c_IShaderProcess*>(t_sh)->p_PostProcess(t_cam);
	}
	return 0;
}
void c_TShader::mark(){
	c_TBrush::mark();
}
String c_TShader::debug(){
	String t="(TShader)\n";
	t=c_TBrush::debug()+t;
	t+=dbg_decl("process_list",&c_TShader::m_process_list);
	t+=dbg_decl("g_shader",&c_TShader::m_g_shader);
	return t;
}
c_List6::c_List6(){
	m__head=((new c_HeadNode6)->m_new());
}
c_List6* c_List6::m_new(){
	DBG_ENTER("List.new")
	c_List6 *self=this;
	DBG_LOCAL(self,"Self")
	return this;
}
c_Node8* c_List6::p_AddLast6(c_TShader* t_data){
	DBG_ENTER("List.AddLast")
	c_List6 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<108>");
	c_Node8* t_=(new c_Node8)->m_new(m__head,m__head->m__pred,t_data);
	return t_;
}
c_List6* c_List6::m_new2(Array<c_TShader* > t_data){
	DBG_ENTER("List.new")
	c_List6 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<13>");
	Array<c_TShader* > t_=t_data;
	int t_2=0;
	while(t_2<t_.Length()){
		DBG_BLOCK();
		c_TShader* t_t=t_.At(t_2);
		t_2=t_2+1;
		DBG_LOCAL(t_t,"t")
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<14>");
		p_AddLast6(t_t);
	}
	return this;
}
c_Enumerator5* c_List6::p_ObjectEnumerator(){
	DBG_ENTER("List.ObjectEnumerator")
	c_List6 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<186>");
	c_Enumerator5* t_=(new c_Enumerator5)->m_new(this);
	return t_;
}
void c_List6::mark(){
	Object::mark();
	gc_mark_q(m__head);
}
String c_List6::debug(){
	String t="(List)\n";
	t+=dbg_decl("_head",&m__head);
	return t;
}
c_Node8::c_Node8(){
	m__succ=0;
	m__pred=0;
	m__data=0;
}
c_Node8* c_Node8::m_new(c_Node8* t_succ,c_Node8* t_pred,c_TShader* t_data){
	DBG_ENTER("Node.new")
	c_Node8 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_succ,"succ")
	DBG_LOCAL(t_pred,"pred")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<261>");
	gc_assign(m__succ,t_succ);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<262>");
	gc_assign(m__pred,t_pred);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<263>");
	gc_assign(m__succ->m__pred,this);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<264>");
	gc_assign(m__pred->m__succ,this);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<265>");
	gc_assign(m__data,t_data);
	return this;
}
c_Node8* c_Node8::m_new2(){
	DBG_ENTER("Node.new")
	c_Node8 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<258>");
	return this;
}
void c_Node8::mark(){
	Object::mark();
	gc_mark_q(m__succ);
	gc_mark_q(m__pred);
	gc_mark_q(m__data);
}
String c_Node8::debug(){
	String t="(Node)\n";
	t+=dbg_decl("_succ",&m__succ);
	t+=dbg_decl("_pred",&m__pred);
	t+=dbg_decl("_data",&m__data);
	return t;
}
c_HeadNode6::c_HeadNode6(){
}
c_HeadNode6* c_HeadNode6::m_new(){
	DBG_ENTER("HeadNode.new")
	c_HeadNode6 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<310>");
	c_Node8::m_new2();
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<311>");
	gc_assign(m__succ,(this));
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<312>");
	gc_assign(m__pred,(this));
	return this;
}
void c_HeadNode6::mark(){
	c_Node8::mark();
}
String c_HeadNode6::debug(){
	String t="(HeadNode)\n";
	t=c_Node8::debug()+t;
	return t;
}
c_Enumerator5::c_Enumerator5(){
	m__list=0;
	m__curr=0;
}
c_Enumerator5* c_Enumerator5::m_new(c_List6* t_list){
	DBG_ENTER("Enumerator.new")
	c_Enumerator5 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_list,"list")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<326>");
	gc_assign(m__list,t_list);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<327>");
	gc_assign(m__curr,t_list->m__head->m__succ);
	return this;
}
c_Enumerator5* c_Enumerator5::m_new2(){
	DBG_ENTER("Enumerator.new")
	c_Enumerator5 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<323>");
	return this;
}
bool c_Enumerator5::p_HasNext(){
	DBG_ENTER("Enumerator.HasNext")
	c_Enumerator5 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<331>");
	while(m__curr->m__succ->m__pred!=m__curr){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<332>");
		gc_assign(m__curr,m__curr->m__succ);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<334>");
	bool t_=m__curr!=m__list->m__head;
	return t_;
}
c_TShader* c_Enumerator5::p_NextObject(){
	DBG_ENTER("Enumerator.NextObject")
	c_Enumerator5 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<338>");
	c_TShader* t_data=m__curr->m__data;
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<339>");
	gc_assign(m__curr,m__curr->m__succ);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<340>");
	return t_data;
}
void c_Enumerator5::mark(){
	Object::mark();
	gc_mark_q(m__list);
	gc_mark_q(m__curr);
}
String c_Enumerator5::debug(){
	String t="(Enumerator)\n";
	t+=dbg_decl("_list",&m__list);
	t+=dbg_decl("_curr",&m__curr);
	return t;
}
c_TLight::c_TLight(){
	m_light_type=0;
	m_light_link=0;
	m_const_att=FLOAT(0.5);
	m_lin_att=FLOAT(1.0);
	m_remove_light=false;
	m_spec_red=FLOAT(0.0);
	m_spec_grn=FLOAT(0.0);
	m_spec_blu=FLOAT(0.0);
	m_spec_a=FLOAT(0.0);
	m_spot_exp=FLOAT(10.0);
	m_red=FLOAT(1.0);
	m_green=FLOAT(1.0);
	m_blue=FLOAT(1.0);
	m_outer_ang=FLOAT(45.0);
}
c_List7* c_TLight::m_light_list;
int c_TLight::m_no_lights;
int c_TLight::m_max_lights;
c_TLight* c_TLight::m_new(){
	DBG_ENTER("TLight.new")
	c_TLight *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tlight.monkey<35>");
	c_TEntity::m_new();
	return this;
}
c_TLight* c_TLight::m_CreateLight(int t_l_type,c_TEntity* t_parent_ent){
	DBG_ENTER("TLight.CreateLight")
	DBG_LOCAL(t_l_type,"l_type")
	DBG_LOCAL(t_parent_ent,"parent_ent")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tlight.monkey<80>");
	if(m_no_lights>=m_max_lights){
		DBG_BLOCK();
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tlight.monkey<82>");
	c_TLight* t_light=(new c_TLight)->m_new();
	DBG_LOCAL(t_light,"light")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tlight.monkey<83>");
	t_light->m_light_type=t_l_type;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tlight.monkey<84>");
	t_light->m_classname=String(L"Light",5);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tlight.monkey<87>");
	m_no_lights=m_no_lights+1;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tlight.monkey<91>");
	gc_assign(t_light->m_light_link,m_light_list->p_AddLast7(t_light));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tlight.monkey<92>");
	gc_assign(t_light->m_entity_link,c_TEntity::m_entity_list->p_EntityListAdd(t_light));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tlight.monkey<93>");
	if((t_parent_ent)!=0){
		DBG_BLOCK();
		t_light->p_AddParent(t_parent_ent);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tlight.monkey<95>");
	if(t_light->m_light_type==1){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tlight.monkey<96>");
		t_light->m_const_att=FLOAT(10.0);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tlight.monkey<97>");
		t_light->m_lin_att=FLOAT(10.0);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tlight.monkey<101>");
	if(t_light->m_parent!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tlight.monkey<102>");
		t_light->m_mat->p_Overwrite(t_light->m_parent->m_mat);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tlight.monkey<103>");
		t_light->p_UpdateMat(false);
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tlight.monkey<105>");
		t_light->p_UpdateMat(true);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tlight.monkey<108>");
	return t_light;
}
Float c_TLight::m_ambient_red;
Float c_TLight::m_ambient_green;
Float c_TLight::m_ambient_blue;
void c_TLight::mark(){
	c_TEntity::mark();
	gc_mark_q(m_light_link);
}
String c_TLight::debug(){
	String t="(TLight)\n";
	t=c_TEntity::debug()+t;
	t+=dbg_decl("no_lights",&c_TLight::m_no_lights);
	t+=dbg_decl("max_lights",&c_TLight::m_max_lights);
	t+=dbg_decl("light_list",&c_TLight::m_light_list);
	t+=dbg_decl("light_link",&m_light_link);
	t+=dbg_decl("light_type",&m_light_type);
	t+=dbg_decl("red",&m_red);
	t+=dbg_decl("green",&m_green);
	t+=dbg_decl("blue",&m_blue);
	t+=dbg_decl("outer_ang",&m_outer_ang);
	t+=dbg_decl("spec_red",&m_spec_red);
	t+=dbg_decl("spec_grn",&m_spec_grn);
	t+=dbg_decl("spec_blu",&m_spec_blu);
	t+=dbg_decl("spec_a",&m_spec_a);
	t+=dbg_decl("const_att",&m_const_att);
	t+=dbg_decl("lin_att",&m_lin_att);
	t+=dbg_decl("spot_exp",&m_spot_exp);
	t+=dbg_decl("ambient_red",&c_TLight::m_ambient_red);
	t+=dbg_decl("ambient_green",&c_TLight::m_ambient_green);
	t+=dbg_decl("ambient_blue",&c_TLight::m_ambient_blue);
	t+=dbg_decl("remove_light",&m_remove_light);
	return t;
}
c_List7::c_List7(){
	m__head=((new c_HeadNode7)->m_new());
}
c_List7* c_List7::m_new(){
	DBG_ENTER("List.new")
	c_List7 *self=this;
	DBG_LOCAL(self,"Self")
	return this;
}
c_Node9* c_List7::p_AddLast7(c_TLight* t_data){
	DBG_ENTER("List.AddLast")
	c_List7 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<108>");
	c_Node9* t_=(new c_Node9)->m_new(m__head,m__head->m__pred,t_data);
	return t_;
}
c_List7* c_List7::m_new2(Array<c_TLight* > t_data){
	DBG_ENTER("List.new")
	c_List7 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<13>");
	Array<c_TLight* > t_=t_data;
	int t_2=0;
	while(t_2<t_.Length()){
		DBG_BLOCK();
		c_TLight* t_t=t_.At(t_2);
		t_2=t_2+1;
		DBG_LOCAL(t_t,"t")
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<14>");
		p_AddLast7(t_t);
	}
	return this;
}
c_Enumerator6* c_List7::p_ObjectEnumerator(){
	DBG_ENTER("List.ObjectEnumerator")
	c_List7 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<186>");
	c_Enumerator6* t_=(new c_Enumerator6)->m_new(this);
	return t_;
}
void c_List7::mark(){
	Object::mark();
	gc_mark_q(m__head);
}
String c_List7::debug(){
	String t="(List)\n";
	t+=dbg_decl("_head",&m__head);
	return t;
}
c_Node9::c_Node9(){
	m__succ=0;
	m__pred=0;
	m__data=0;
}
c_Node9* c_Node9::m_new(c_Node9* t_succ,c_Node9* t_pred,c_TLight* t_data){
	DBG_ENTER("Node.new")
	c_Node9 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_succ,"succ")
	DBG_LOCAL(t_pred,"pred")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<261>");
	gc_assign(m__succ,t_succ);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<262>");
	gc_assign(m__pred,t_pred);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<263>");
	gc_assign(m__succ->m__pred,this);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<264>");
	gc_assign(m__pred->m__succ,this);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<265>");
	gc_assign(m__data,t_data);
	return this;
}
c_Node9* c_Node9::m_new2(){
	DBG_ENTER("Node.new")
	c_Node9 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<258>");
	return this;
}
int c_Node9::p_Remove(){
	DBG_ENTER("Node.Remove")
	c_Node9 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<274>");
	if(m__succ->m__pred!=this){
		DBG_BLOCK();
		bbError(String(L"Illegal operation on removed node",33));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<276>");
	gc_assign(m__succ->m__pred,m__pred);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<277>");
	gc_assign(m__pred->m__succ,m__succ);
	return 0;
}
void c_Node9::mark(){
	Object::mark();
	gc_mark_q(m__succ);
	gc_mark_q(m__pred);
	gc_mark_q(m__data);
}
String c_Node9::debug(){
	String t="(Node)\n";
	t+=dbg_decl("_succ",&m__succ);
	t+=dbg_decl("_pred",&m__pred);
	t+=dbg_decl("_data",&m__data);
	return t;
}
c_HeadNode7::c_HeadNode7(){
}
c_HeadNode7* c_HeadNode7::m_new(){
	DBG_ENTER("HeadNode.new")
	c_HeadNode7 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<310>");
	c_Node9::m_new2();
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<311>");
	gc_assign(m__succ,(this));
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<312>");
	gc_assign(m__pred,(this));
	return this;
}
void c_HeadNode7::mark(){
	c_Node9::mark();
}
String c_HeadNode7::debug(){
	String t="(HeadNode)\n";
	t=c_Node9::debug()+t;
	return t;
}
c_Enumerator6::c_Enumerator6(){
	m__list=0;
	m__curr=0;
}
c_Enumerator6* c_Enumerator6::m_new(c_List7* t_list){
	DBG_ENTER("Enumerator.new")
	c_Enumerator6 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_list,"list")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<326>");
	gc_assign(m__list,t_list);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<327>");
	gc_assign(m__curr,t_list->m__head->m__succ);
	return this;
}
c_Enumerator6* c_Enumerator6::m_new2(){
	DBG_ENTER("Enumerator.new")
	c_Enumerator6 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<323>");
	return this;
}
bool c_Enumerator6::p_HasNext(){
	DBG_ENTER("Enumerator.HasNext")
	c_Enumerator6 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<331>");
	while(m__curr->m__succ->m__pred!=m__curr){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<332>");
		gc_assign(m__curr,m__curr->m__succ);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<334>");
	bool t_=m__curr!=m__list->m__head;
	return t_;
}
c_TLight* c_Enumerator6::p_NextObject(){
	DBG_ENTER("Enumerator.NextObject")
	c_Enumerator6 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<338>");
	c_TLight* t_data=m__curr->m__data;
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<339>");
	gc_assign(m__curr,m__curr->m__succ);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<340>");
	return t_data;
}
void c_Enumerator6::mark(){
	Object::mark();
	gc_mark_q(m__list);
	gc_mark_q(m__curr);
}
String c_Enumerator6::debug(){
	String t="(Enumerator)\n";
	t+=dbg_decl("_list",&m__list);
	t+=dbg_decl("_curr",&m__curr);
	return t;
}
c_RenderAlphaList::c_RenderAlphaList(){
}
c_RenderAlphaList* c_RenderAlphaList::m_new(){
	DBG_ENTER("RenderAlphaList.new")
	c_RenderAlphaList *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<792>");
	c_List3::m_new();
	return this;
}
int c_RenderAlphaList::p_Compare2(c_TMesh* t_left,c_TMesh* t_right){
	DBG_ENTER("RenderAlphaList.Compare")
	c_RenderAlphaList *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_left,"left")
	DBG_LOCAL(t_right,"right")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<796>");
	if(t_left->m_alpha_order>t_right->m_alpha_order){
		DBG_BLOCK();
		return -1;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<797>");
	int t_=((t_left->m_alpha_order<t_right->m_alpha_order)?1:0);
	return t_;
}
void c_RenderAlphaList::mark(){
	c_List3::mark();
}
String c_RenderAlphaList::debug(){
	String t="(RenderAlphaList)\n";
	t=c_List3::debug()+t;
	return t;
}
c_Enumerator7::c_Enumerator7(){
	m__list=0;
	m__curr=0;
}
c_Enumerator7* c_Enumerator7::m_new(c_List* t_list){
	DBG_ENTER("Enumerator.new")
	c_Enumerator7 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_list,"list")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<326>");
	gc_assign(m__list,t_list);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<327>");
	gc_assign(m__curr,t_list->m__head->m__succ);
	return this;
}
c_Enumerator7* c_Enumerator7::m_new2(){
	DBG_ENTER("Enumerator.new")
	c_Enumerator7 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<323>");
	return this;
}
bool c_Enumerator7::p_HasNext(){
	DBG_ENTER("Enumerator.HasNext")
	c_Enumerator7 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<331>");
	while(m__curr->m__succ->m__pred!=m__curr){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<332>");
		gc_assign(m__curr,m__curr->m__succ);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<334>");
	bool t_=m__curr!=m__list->m__head;
	return t_;
}
c_TEntity* c_Enumerator7::p_NextObject(){
	DBG_ENTER("Enumerator.NextObject")
	c_Enumerator7 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<338>");
	c_TEntity* t_data=m__curr->m__data;
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<339>");
	gc_assign(m__curr,m__curr->m__succ);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<340>");
	return t_data;
}
void c_Enumerator7::mark(){
	Object::mark();
	gc_mark_q(m__list);
	gc_mark_q(m__curr);
}
String c_Enumerator7::debug(){
	String t="(Enumerator)\n";
	t+=dbg_decl("_list",&m__list);
	t+=dbg_decl("_curr",&m__curr);
	return t;
}
c_Enumerator8::c_Enumerator8(){
	m__list=0;
	m__curr=0;
}
c_Enumerator8* c_Enumerator8::m_new(c_List2* t_list){
	DBG_ENTER("Enumerator.new")
	c_Enumerator8 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_list,"list")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<326>");
	gc_assign(m__list,t_list);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<327>");
	gc_assign(m__curr,t_list->m__head->m__succ);
	return this;
}
c_Enumerator8* c_Enumerator8::m_new2(){
	DBG_ENTER("Enumerator.new")
	c_Enumerator8 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<323>");
	return this;
}
bool c_Enumerator8::p_HasNext(){
	DBG_ENTER("Enumerator.HasNext")
	c_Enumerator8 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<331>");
	while(m__curr->m__succ->m__pred!=m__curr){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<332>");
		gc_assign(m__curr,m__curr->m__succ);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<334>");
	bool t_=m__curr!=m__list->m__head;
	return t_;
}
c_TSurface* c_Enumerator8::p_NextObject(){
	DBG_ENTER("Enumerator.NextObject")
	c_Enumerator8 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<338>");
	c_TSurface* t_data=m__curr->m__data;
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<339>");
	gc_assign(m__curr,m__curr->m__succ);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<340>");
	return t_data;
}
void c_Enumerator8::mark(){
	Object::mark();
	gc_mark_q(m__list);
	gc_mark_q(m__curr);
}
String c_Enumerator8::debug(){
	String t="(Enumerator)\n";
	t+=dbg_decl("_list",&m__list);
	t+=dbg_decl("_curr",&m__curr);
	return t;
}
c_VertexDataBuffer::c_VertexDataBuffer(){
	m_buf=0;
}
c_VertexDataBuffer* c_VertexDataBuffer::m_new(){
	DBG_ENTER("VertexDataBuffer.new")
	c_VertexDataBuffer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<88>");
	return this;
}
void c_VertexDataBuffer::p_GetVertCoords(c_Vector* t_vec,int t_vid){
	DBG_ENTER("VertexDataBuffer.GetVertCoords")
	c_VertexDataBuffer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_vec,"vec")
	DBG_LOCAL(t_vid,"vid")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<208>");
	int t_v=t_vid*64+0;
	DBG_LOCAL(t_v,"v")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<209>");
	t_vec->m_x=m_buf->PeekFloat(t_v+0);
	t_vec->m_y=m_buf->PeekFloat(t_v+4);
	t_vec->m_z=m_buf->PeekFloat(t_v+8);
}
c_VertexDataBuffer* c_VertexDataBuffer::m_Create(int t_i){
	DBG_ENTER("VertexDataBuffer.Create")
	DBG_LOCAL(t_i,"i")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<111>");
	c_VertexDataBuffer* t_b=(new c_VertexDataBuffer)->m_new();
	DBG_LOCAL(t_b,"b")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<112>");
	gc_assign(t_b->m_buf,bb_monkeybuffer_CreateDataBuffer((t_i+1)*64));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<120>");
	return t_b;
}
void c_VertexDataBuffer::p_PokeFloatArray(int t_i,Array<Float > t_arr,int t_len){
	DBG_ENTER("VertexDataBuffer.PokeFloatArray")
	c_VertexDataBuffer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_i,"i")
	DBG_LOCAL(t_arr,"arr")
	DBG_LOCAL(t_len,"len")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<252>");
	if(t_len==-1){
		DBG_BLOCK();
		t_len=t_arr.Length();
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<259>");
	for(int t_v=0;t_v<=t_len-1;t_v=t_v+1){
		DBG_BLOCK();
		DBG_LOCAL(t_v,"v")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<260>");
		m_buf->PokeFloat(t_i*64+t_v*4,t_arr.At(t_v));
	}
}
int c_VertexDataBuffer::p_PokeNormals(int t_i,Float t_x,Float t_y,Float t_z){
	DBG_ENTER("VertexDataBuffer.PokeNormals")
	c_VertexDataBuffer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_i,"i")
	DBG_LOCAL(t_x,"x")
	DBG_LOCAL(t_y,"y")
	DBG_LOCAL(t_z,"z")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<143>");
	int t_index=t_i*64+16;
	DBG_LOCAL(t_index,"index")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<144>");
	m_buf->PokeFloat(t_index,t_x);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<145>");
	m_buf->PokeFloat(t_index+4,t_y);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<146>");
	m_buf->PokeFloat(t_index+8,t_z);
	return 0;
}
int c_VertexDataBuffer::p_PokeTexCoords0(int t_i,Float t_s0,Float t_t0){
	DBG_ENTER("VertexDataBuffer.PokeTexCoords0")
	c_VertexDataBuffer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_i,"i")
	DBG_LOCAL(t_s0,"s0")
	DBG_LOCAL(t_t0,"t0")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<165>");
	int t_index=t_i*64+48;
	DBG_LOCAL(t_index,"index")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<166>");
	m_buf->PokeFloat(t_index,t_s0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<167>");
	m_buf->PokeFloat(t_index+4,t_t0);
	return 0;
}
int c_VertexDataBuffer::p_PokeTexCoords1(int t_i,Float t_s1,Float t_t1){
	DBG_ENTER("VertexDataBuffer.PokeTexCoords1")
	c_VertexDataBuffer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_i,"i")
	DBG_LOCAL(t_s1,"s1")
	DBG_LOCAL(t_t1,"t1")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<171>");
	int t_index=t_i*64+48;
	DBG_LOCAL(t_index,"index")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<172>");
	m_buf->PokeFloat(t_index+8,t_s1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<173>");
	m_buf->PokeFloat(t_index+12,t_t1);
	return 0;
}
Float c_VertexDataBuffer::p_VertexX(int t_vid){
	DBG_ENTER("VertexDataBuffer.VertexX")
	c_VertexDataBuffer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_vid,"vid")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<191>");
	Float t_=m_buf->PeekFloat(t_vid*64+0+0);
	return t_;
}
Float c_VertexDataBuffer::p_VertexY(int t_vid){
	DBG_ENTER("VertexDataBuffer.VertexY")
	c_VertexDataBuffer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_vid,"vid")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<195>");
	Float t_=m_buf->PeekFloat(t_vid*64+0+4);
	return t_;
}
Float c_VertexDataBuffer::p_VertexZ(int t_vid){
	DBG_ENTER("VertexDataBuffer.VertexZ")
	c_VertexDataBuffer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_vid,"vid")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<199>");
	Float t_=m_buf->PeekFloat(t_vid*64+0+8);
	return t_;
}
c_Vector* c_VertexDataBuffer::p_PeekVertCoords(int t_vid){
	DBG_ENTER("VertexDataBuffer.PeekVertCoords")
	c_VertexDataBuffer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_vid,"vid")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<203>");
	int t_v=t_vid*64+0;
	DBG_LOCAL(t_v,"v")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<204>");
	c_Vector* t_=(new c_Vector)->m_new(m_buf->PeekFloat(t_v+0),m_buf->PeekFloat(t_v+4),m_buf->PeekFloat(t_v+8));
	return t_;
}
c_DataBuffer* c_VertexDataBuffer::p_BufferSlice(int t_start){
	DBG_ENTER("VertexDataBuffer.BufferSlice")
	c_VertexDataBuffer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_start,"start")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<279>");
	c_DataBuffer* t_=m_buf->p_Slice2(t_start);
	return t_;
}
int c_VertexDataBuffer::p_PokeColor(int t_i,Float t_r,Float t_g,Float t_b,Float t_a){
	DBG_ENTER("VertexDataBuffer.PokeColor")
	c_VertexDataBuffer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_i,"i")
	DBG_LOCAL(t_r,"r")
	DBG_LOCAL(t_g,"g")
	DBG_LOCAL(t_b,"b")
	DBG_LOCAL(t_a,"a")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<182>");
	int t_index=t_i*64+32;
	DBG_LOCAL(t_index,"index")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<183>");
	m_buf->PokeFloat(t_index,t_r);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<184>");
	m_buf->PokeFloat(t_index+4,t_g);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<185>");
	m_buf->PokeFloat(t_index+8,t_b);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<186>");
	m_buf->PokeFloat(t_index+12,t_a);
	return 0;
}
void c_VertexDataBuffer::mark(){
	Object::mark();
	gc_mark_q(m_buf);
}
String c_VertexDataBuffer::debug(){
	String t="(VertexDataBuffer)\n";
	t+=dbg_decl("buf",&m_buf);
	return t;
}
c_DataBuffer::c_DataBuffer(){
}
c_DataBuffer* c_DataBuffer::m_new(int t_length){
	DBG_ENTER("DataBuffer.new")
	c_DataBuffer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_length,"length")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<94>");
	if(!_New(t_length)){
		DBG_BLOCK();
		bbError(String(L"Allocate DataBuffer failed",26));
	}
	return this;
}
c_DataBuffer* c_DataBuffer::m_new2(){
	DBG_ENTER("DataBuffer.new")
	c_DataBuffer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<91>");
	return this;
}
void c_DataBuffer::p_PokeBytes(int t_address,Array<int > t_bytes,int t_offset,int t_count){
	DBG_ENTER("DataBuffer.PokeBytes")
	c_DataBuffer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_address,"address")
	DBG_LOCAL(t_bytes,"bytes")
	DBG_LOCAL(t_offset,"offset")
	DBG_LOCAL(t_count,"count")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<145>");
	if(t_address+t_count>Length()){
		DBG_BLOCK();
		t_count=Length()-t_address;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<146>");
	if(t_offset+t_count>t_bytes.Length()){
		DBG_BLOCK();
		t_count=t_bytes.Length()-t_offset;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<147>");
	for(int t_i=0;t_i<t_count;t_i=t_i+1){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<148>");
		PokeByte(t_address+t_i,t_bytes.At(t_offset+t_i));
	}
}
int c_DataBuffer::p_PokeString(int t_address,String t_str,String t_encoding){
	DBG_ENTER("DataBuffer.PokeString")
	c_DataBuffer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_address,"address")
	DBG_LOCAL(t_str,"str")
	DBG_LOCAL(t_encoding,"encoding")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<256>");
	String t_2=t_encoding;
	DBG_LOCAL(t_2,"2")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<257>");
	if(t_2==String(L"utf8",4)){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<258>");
		Array<int > t_p=t_str.ToChars();
		DBG_LOCAL(t_p,"p")
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<259>");
		int t_i=0;
		int t_e=t_p.Length();
		DBG_LOCAL(t_i,"i")
		DBG_LOCAL(t_e,"e")
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<260>");
		Array<int > t_q=Array<int >(t_e*3);
		int t_j=0;
		DBG_LOCAL(t_q,"q")
		DBG_LOCAL(t_j,"j")
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<261>");
		while(t_i<t_e){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<262>");
			int t_c=t_p.At(t_i)&65535;
			DBG_LOCAL(t_c,"c")
			DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<263>");
			t_i+=1;
			DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<264>");
			if(t_c<128){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<265>");
				t_q.At(t_j)=t_c;
				DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<266>");
				t_j+=1;
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<267>");
				if(t_c<2048){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<268>");
					t_q.At(t_j)=192|t_c>>6;
					DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<269>");
					t_q.At(t_j+1)=128|t_c&63;
					DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<270>");
					t_j+=2;
				}else{
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<272>");
					t_q.At(t_j)=224|t_c>>12;
					DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<273>");
					t_q.At(t_j+1)=128|t_c>>6&63;
					DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<274>");
					t_q.At(t_j+2)=128|t_c&63;
					DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<275>");
					t_j+=3;
				}
			}
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<278>");
		p_PokeBytes(t_address,t_q,0,t_j);
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<279>");
		return t_j;
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<280>");
		if(t_2==String(L"ascii",5)){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<281>");
			p_PokeBytes(t_address,t_str.ToChars(),0,t_str.Length());
			DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<282>");
			int t_=t_str.Length();
			return t_;
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<285>");
	bbError(String(L"Invalid string encoding:",24)+t_encoding);
	return 0;
}
void c_DataBuffer::p_CopyBytes(int t_address,c_DataBuffer* t_dst,int t_dstaddress,int t_count){
	DBG_ENTER("DataBuffer.CopyBytes")
	c_DataBuffer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_address,"address")
	DBG_LOCAL(t_dst,"dst")
	DBG_LOCAL(t_dstaddress,"dstaddress")
	DBG_LOCAL(t_count,"count")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<114>");
	if(t_address+t_count>Length()){
		DBG_BLOCK();
		t_count=Length()-t_address;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<115>");
	if(t_dstaddress+t_count>t_dst->Length()){
		DBG_BLOCK();
		t_count=t_dst->Length()-t_dstaddress;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<117>");
	if(t_dstaddress<=t_address){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<118>");
		for(int t_i=0;t_i<t_count;t_i=t_i+1){
			DBG_BLOCK();
			DBG_LOCAL(t_i,"i")
			DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<119>");
			t_dst->PokeByte(t_dstaddress+t_i,PeekByte(t_address+t_i));
		}
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<122>");
		for(int t_i2=t_count-1;t_i2>=0;t_i2=t_i2+-1){
			DBG_BLOCK();
			DBG_LOCAL(t_i2,"i")
			DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<123>");
			t_dst->PokeByte(t_dstaddress+t_i2,PeekByte(t_address+t_i2));
		}
	}
}
c_DataBuffer* c_DataBuffer::p_Slice(int t_start,int t_term){
	DBG_ENTER("DataBuffer.Slice")
	c_DataBuffer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_start,"start")
	DBG_LOCAL(t_term,"term")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<102>");
	if(t_start<0){
		DBG_BLOCK();
		t_start=0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<103>");
	if(t_term>Length()){
		DBG_BLOCK();
		t_term=Length();
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<104>");
	int t_len=t_term-t_start;
	DBG_LOCAL(t_len,"len")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<105>");
	if(t_len<=0){
		DBG_BLOCK();
		c_DataBuffer* t_=(new c_DataBuffer)->m_new(0);
		return t_;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<106>");
	c_DataBuffer* t_buf=(new c_DataBuffer)->m_new(t_len);
	DBG_LOCAL(t_buf,"buf")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<107>");
	p_CopyBytes(t_start,t_buf,0,t_len);
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<108>");
	return t_buf;
}
c_DataBuffer* c_DataBuffer::p_Slice2(int t_start){
	DBG_ENTER("DataBuffer.Slice")
	c_DataBuffer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_start,"start")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<98>");
	c_DataBuffer* t_=p_Slice(t_start,Length());
	return t_;
}
void c_DataBuffer::p_PeekBytes(int t_address,Array<int > t_bytes,int t_offset,int t_count){
	DBG_ENTER("DataBuffer.PeekBytes")
	c_DataBuffer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_address,"address")
	DBG_LOCAL(t_bytes,"bytes")
	DBG_LOCAL(t_offset,"offset")
	DBG_LOCAL(t_count,"count")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<137>");
	if(t_address+t_count>Length()){
		DBG_BLOCK();
		t_count=Length()-t_address;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<138>");
	if(t_offset+t_count>t_bytes.Length()){
		DBG_BLOCK();
		t_count=t_bytes.Length()-t_offset;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<139>");
	for(int t_i=0;t_i<t_count;t_i=t_i+1){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<140>");
		t_bytes.At(t_offset+t_i)=PeekByte(t_address+t_i);
	}
}
Array<int > c_DataBuffer::p_PeekBytes2(int t_address,int t_count){
	DBG_ENTER("DataBuffer.PeekBytes")
	c_DataBuffer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_address,"address")
	DBG_LOCAL(t_count,"count")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<130>");
	if(t_address+t_count>Length()){
		DBG_BLOCK();
		t_count=Length()-t_address;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<131>");
	Array<int > t_bytes=Array<int >(t_count);
	DBG_LOCAL(t_bytes,"bytes")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<132>");
	p_PeekBytes(t_address,t_bytes,0,t_count);
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<133>");
	return t_bytes;
}
String c_DataBuffer::p_PeekString(int t_address,int t_count,String t_encoding){
	DBG_ENTER("DataBuffer.PeekString")
	c_DataBuffer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_address,"address")
	DBG_LOCAL(t_count,"count")
	DBG_LOCAL(t_encoding,"encoding")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<206>");
	String t_1=t_encoding;
	DBG_LOCAL(t_1,"1")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<207>");
	if(t_1==String(L"utf8",4)){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<208>");
		Array<int > t_p=p_PeekBytes2(t_address,t_count);
		DBG_LOCAL(t_p,"p")
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<209>");
		int t_i=0;
		int t_e=t_p.Length();
		bool t_err=false;
		DBG_LOCAL(t_i,"i")
		DBG_LOCAL(t_e,"e")
		DBG_LOCAL(t_err,"err")
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<210>");
		Array<int > t_q=Array<int >(t_e);
		int t_j=0;
		DBG_LOCAL(t_q,"q")
		DBG_LOCAL(t_j,"j")
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<211>");
		while(t_i<t_e){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<212>");
			int t_c=t_p.At(t_i)&255;
			DBG_LOCAL(t_c,"c")
			DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<213>");
			t_i+=1;
			DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<214>");
			if((t_c&128)!=0){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<215>");
				if((t_c&224)==192){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<216>");
					if(t_i>=t_e || (t_p.At(t_i)&192)!=128){
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<217>");
						t_err=true;
						DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<218>");
						break;
					}
					DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<220>");
					t_c=(t_c&31)<<6|t_p.At(t_i)&63;
					DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<221>");
					t_i+=1;
				}else{
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<222>");
					if((t_c&240)==224){
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<223>");
						if(t_i+1>=t_e || (t_p.At(t_i)&192)!=128 || (t_p.At(t_i+1)&192)!=128){
							DBG_BLOCK();
							DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<224>");
							t_err=true;
							DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<225>");
							break;
						}
						DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<227>");
						t_c=(t_c&15)<<12|(t_p.At(t_i)&63)<<6|t_p.At(t_i+1)&63;
						DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<228>");
						t_i+=2;
					}else{
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<230>");
						t_err=true;
						DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<231>");
						break;
					}
				}
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<234>");
			t_q.At(t_j)=t_c;
			DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<235>");
			t_j+=1;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<237>");
		if(t_err){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<239>");
			String t_=String::FromChars(t_p);
			return t_;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<241>");
		if(t_j<t_e){
			DBG_BLOCK();
			t_q=t_q.Slice(0,t_j);
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<242>");
		String t_2=String::FromChars(t_q);
		return t_2;
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<243>");
		if(t_1==String(L"ascii",5)){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<244>");
			Array<int > t_p2=p_PeekBytes2(t_address,t_count);
			DBG_LOCAL(t_p2,"p")
			DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<245>");
			for(int t_i2=0;t_i2<t_p2.Length();t_i2=t_i2+1){
				DBG_BLOCK();
				DBG_LOCAL(t_i2,"i")
				DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<246>");
				t_p2.At(t_i2)&=255;
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<248>");
			String t_3=String::FromChars(t_p2);
			return t_3;
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<251>");
	bbError(String(L"Invalid string encoding:",24)+t_encoding);
	return String();
}
String c_DataBuffer::p_PeekString2(int t_address,String t_encoding){
	DBG_ENTER("DataBuffer.PeekString")
	c_DataBuffer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_address,"address")
	DBG_LOCAL(t_encoding,"encoding")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/databuffer.monkey<201>");
	String t_=p_PeekString(t_address,Length()-t_address,t_encoding);
	return t_;
}
void c_DataBuffer::mark(){
	BBDataBuffer::mark();
}
String c_DataBuffer::debug(){
	String t="(DataBuffer)\n";
	return t;
}
int bb_math2_Abs(int t_x){
	DBG_ENTER("Abs")
	DBG_LOCAL(t_x,"x")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/math.monkey<46>");
	if(t_x>=0){
		DBG_BLOCK();
		return t_x;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/math.monkey<47>");
	int t_=-t_x;
	return t_;
}
Float bb_math2_Abs2(Float t_x){
	DBG_ENTER("Abs")
	DBG_LOCAL(t_x,"x")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/math.monkey<73>");
	if(t_x>=FLOAT(0.0)){
		DBG_BLOCK();
		return t_x;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/math.monkey<74>");
	Float t_=-t_x;
	return t_;
}
c_Enumerator9::c_Enumerator9(){
	m__list=0;
	m__curr=0;
}
c_Enumerator9* c_Enumerator9::m_new(c_List3* t_list){
	DBG_ENTER("Enumerator.new")
	c_Enumerator9 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_list,"list")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<326>");
	gc_assign(m__list,t_list);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<327>");
	gc_assign(m__curr,t_list->m__head->m__succ);
	return this;
}
c_Enumerator9* c_Enumerator9::m_new2(){
	DBG_ENTER("Enumerator.new")
	c_Enumerator9 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<323>");
	return this;
}
bool c_Enumerator9::p_HasNext(){
	DBG_ENTER("Enumerator.HasNext")
	c_Enumerator9 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<331>");
	while(m__curr->m__succ->m__pred!=m__curr){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<332>");
		gc_assign(m__curr,m__curr->m__succ);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<334>");
	bool t_=m__curr!=m__list->m__head;
	return t_;
}
c_TMesh* c_Enumerator9::p_NextObject(){
	DBG_ENTER("Enumerator.NextObject")
	c_Enumerator9 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<338>");
	c_TMesh* t_data=m__curr->m__data;
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<339>");
	gc_assign(m__curr,m__curr->m__succ);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<340>");
	return t_data;
}
void c_Enumerator9::mark(){
	Object::mark();
	gc_mark_q(m__list);
	gc_mark_q(m__curr);
}
String c_Enumerator9::debug(){
	String t="(Enumerator)\n";
	t+=dbg_decl("_list",&m__list);
	t+=dbg_decl("_curr",&m__curr);
	return t;
}
c_BlankShader::c_BlankShader(){
}
c_BlankShader* c_BlankShader::m_new(){
	DBG_ENTER("BlankShader.new")
	c_BlankShader *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tshader.monkey<12>");
	return this;
}
void c_BlankShader::p_SetShader2D(){
	DBG_ENTER("BlankShader.SetShader2D")
	c_BlankShader *self=this;
	DBG_LOCAL(self,"Self")
}
void c_BlankShader::mark(){
	Object::mark();
}
String c_BlankShader::debug(){
	String t="(BlankShader)\n";
	return t;
}
c_DataBuffer* bb_monkeybuffer_CreateDataBuffer(int t_i){
	DBG_ENTER("CreateDataBuffer")
	DBG_LOCAL(t_i,"i")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<36>");
	c_DataBuffer* t_=(new c_DataBuffer)->m_new(t_i);
	return t_;
}
int bb_monkeybuffer_GetBufferLength(c_DataBuffer* t_buf){
	DBG_ENTER("GetBufferLength")
	DBG_LOCAL(t_buf,"buf")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<39>");
	int t_=t_buf->Length();
	return t_;
}
c_DataBuffer* bb_monkeybuffer_CopyDataBuffer(c_DataBuffer* t_src,c_DataBuffer* t_dest){
	DBG_ENTER("CopyDataBuffer")
	DBG_LOCAL(t_src,"src")
	DBG_LOCAL(t_dest,"dest")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<294>");
	if(t_src==0){
		DBG_BLOCK();
		return t_dest;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<296>");
	int t_size=bb_monkeybuffer_GetBufferLength(t_src);
	DBG_LOCAL(t_size,"size")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<297>");
	if(bb_monkeybuffer_GetBufferLength(t_dest)<t_size){
		DBG_BLOCK();
		t_size=bb_monkeybuffer_GetBufferLength(t_dest);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<299>");
	for(int t_i=0;t_i<=t_size-1;t_i=t_i+1){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<300>");
		t_dest->PokeByte(t_i,t_src->PeekByte(t_i));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<303>");
	return t_dest;
}
c_VertexDataBuffer* bb_monkeybuffer_CopyDataBuffer2(c_VertexDataBuffer* t_src,c_VertexDataBuffer* t_dest){
	DBG_ENTER("CopyDataBuffer")
	DBG_LOCAL(t_src,"src")
	DBG_LOCAL(t_dest,"dest")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<308>");
	if(t_src->m_buf==0){
		DBG_BLOCK();
		return t_dest;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<310>");
	int t_size=bb_monkeybuffer_GetBufferLength(t_src->m_buf);
	DBG_LOCAL(t_size,"size")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<311>");
	if(bb_monkeybuffer_GetBufferLength(t_dest->m_buf)<t_size){
		DBG_BLOCK();
		t_size=bb_monkeybuffer_GetBufferLength(t_dest->m_buf);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<314>");
	for(int t_i=0;t_i<=t_size-1;t_i=t_i+4){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<315>");
		t_dest->m_buf->PokeInt(t_i,t_src->m_buf->PeekInt(t_i));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<319>");
	return t_dest;
}
c_VertexDataBuffer* bb_monkeybuffer_CopyDataBuffer3(c_VertexDataBuffer* t_src,c_VertexDataBuffer* t_dest,int t_begin,int t_bend){
	DBG_ENTER("CopyDataBuffer")
	DBG_LOCAL(t_src,"src")
	DBG_LOCAL(t_dest,"dest")
	DBG_LOCAL(t_begin,"begin")
	DBG_LOCAL(t_bend,"bend")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<324>");
	if(t_src->m_buf==0){
		DBG_BLOCK();
		return t_dest;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<326>");
	t_begin*=64;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<327>");
	t_bend*=64;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<329>");
	if(t_begin==0 && t_bend==0){
		DBG_BLOCK();
		t_bend=bb_monkeybuffer_GetBufferLength(t_src->m_buf)-1;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<330>");
	if(bb_monkeybuffer_GetBufferLength(t_dest->m_buf)-1<t_bend){
		DBG_BLOCK();
		t_bend=bb_monkeybuffer_GetBufferLength(t_dest->m_buf)-1;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<332>");
	for(int t_i=t_begin;t_i<=t_bend;t_i=t_i+4){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<334>");
		t_dest->m_buf->PokeInt(t_i,t_src->m_buf->PeekInt(t_i));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<337>");
	return t_dest;
}
c_ShortBuffer::c_ShortBuffer(){
	m_buf=0;
}
c_ShortBuffer* c_ShortBuffer::m_new(){
	DBG_ENTER("ShortBuffer.new")
	c_ShortBuffer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<411>");
	return this;
}
c_DataBuffer* c_ShortBuffer::m_i2f;
c_ShortBuffer* c_ShortBuffer::m_Create(int t_i){
	DBG_ENTER("ShortBuffer.Create")
	DBG_LOCAL(t_i,"i")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<420>");
	gc_assign(m_i2f,bb_monkeybuffer_CreateDataBuffer(4));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<422>");
	c_ShortBuffer* t_b=(new c_ShortBuffer)->m_new();
	DBG_LOCAL(t_b,"b")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<423>");
	gc_assign(t_b->m_buf,bb_monkeybuffer_CreateDataBuffer(t_i*2+1));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<431>");
	return t_b;
}
int c_ShortBuffer::p_Length2(){
	DBG_ENTER("ShortBuffer.Length")
	c_ShortBuffer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<459>");
	int t_=int(Float(bb_monkeybuffer_GetBufferLength(m_buf))*FLOAT(0.5));
	return t_;
}
int c_ShortBuffer::p_Peek(int t_i){
	DBG_ENTER("ShortBuffer.Peek")
	c_ShortBuffer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_i,"i")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<455>");
	int t_=m_buf->PeekShort(t_i*2);
	return t_;
}
void c_ShortBuffer::p_Poke(int t_i,Array<int > t_arr,int t_len){
	DBG_ENTER("ShortBuffer.Poke")
	c_ShortBuffer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_i,"i")
	DBG_LOCAL(t_arr,"arr")
	DBG_LOCAL(t_len,"len")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<435>");
	if(t_len==-1){
		DBG_BLOCK();
		t_len=t_arr.Length();
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<442>");
	for(int t_v=0;t_v<=t_len-1;t_v=t_v+1){
		DBG_BLOCK();
		DBG_LOCAL(t_v,"v")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<443>");
		m_buf->PokeShort((t_i+t_v)*2,t_arr.At(t_v));
	}
}
void c_ShortBuffer::p_Poke2(int t_i,int t_v){
	DBG_ENTER("ShortBuffer.Poke")
	c_ShortBuffer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_i,"i")
	DBG_LOCAL(t_v,"v")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<450>");
	m_buf->PokeShort(t_i*2,t_v);
}
void c_ShortBuffer::mark(){
	Object::mark();
	gc_mark_q(m_buf);
}
String c_ShortBuffer::debug(){
	String t="(ShortBuffer)\n";
	t+=dbg_decl("buf",&m_buf);
	t+=dbg_decl("i2f",&c_ShortBuffer::m_i2f);
	return t;
}
c_ShortBuffer* bb_monkeybuffer_CopyShortBuffer(c_ShortBuffer* t_src,c_ShortBuffer* t_dest){
	DBG_ENTER("CopyShortBuffer")
	DBG_LOCAL(t_src,"src")
	DBG_LOCAL(t_dest,"dest")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<504>");
	if(t_src==0 || t_src->m_buf==0){
		DBG_BLOCK();
		return t_dest;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<506>");
	int t_size=t_src->p_Length2();
	DBG_LOCAL(t_size,"size")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<507>");
	if(t_dest->p_Length2()<t_size){
		DBG_BLOCK();
		t_size=t_dest->p_Length2();
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<509>");
	for(int t_i=0;t_i<=t_size-1;t_i=t_i+1){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<510>");
		t_dest->p_Poke2(t_i,t_src->p_Peek(t_i));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeybuffer.monkey<513>");
	return t_dest;
}
Array<Array<Float > > bb_monkeyutility_AllocateFloatArray(int t_i,int t_j){
	DBG_ENTER("AllocateFloatArray")
	DBG_LOCAL(t_i,"i")
	DBG_LOCAL(t_j,"j")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeyutility.monkey<18>");
	Array<Array<Float > > t_arr=Array<Array<Float > >(t_i);
	DBG_LOCAL(t_arr,"arr")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeyutility.monkey<19>");
	for(int t_ind=0;t_ind<t_i;t_ind=t_ind+1){
		DBG_BLOCK();
		DBG_LOCAL(t_ind,"ind")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeyutility.monkey<20>");
		gc_assign(t_arr.At(t_ind),Array<Float >(t_j));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/monkeyutility.monkey<22>");
	return t_arr;
}
c_TSprite::c_TSprite(){
	m_pixel_scale=Array<Float >(2);
	m_mat_sp=(new c_Matrix)->m_new();
	m_scale_x=FLOAT(1.0);
	m_scale_y=FLOAT(1.0);
	m_view_mode=1;
	m_angle=FLOAT(.0);
	m_handle_x=FLOAT(.0);
	m_handle_y=FLOAT(.0);
}
c_TSprite* c_TSprite::m_new(){
	DBG_ENTER("TSprite.new")
	c_TSprite *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsprite.monkey<23>");
	c_TMesh::m_new();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsprite.monkey<25>");
	m_is_sprite=true;
	return this;
}
c_TEntity* c_TSprite::p_ScaleSprite(Float t_s_x,Float t_s_y){
	DBG_ENTER("TSprite.ScaleSprite")
	c_TSprite *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_s_x,"s_x")
	DBG_LOCAL(t_s_y,"s_y")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsprite.monkey<156>");
	m_scale_x=t_s_x;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsprite.monkey<157>");
	m_scale_y=t_s_y;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsprite.monkey<160>");
	if((m_parent)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsprite.monkey<161>");
		m_gsx=t_s_x*m_parent->m_gsx;
		m_gsy=t_s_y*m_parent->m_gsy;
		m_gsz=m_gsx;
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsprite.monkey<163>");
		m_gsx=t_s_x;
		m_gsy=t_s_y;
		m_gsz=m_gsx;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsprite.monkey<166>");
	c_TEntity* t_=(this);
	return t_;
}
c_TEntity* c_TSprite::p_ScaleEntity(Float t_x,Float t_y,Float t_z,int t_glob){
	DBG_ENTER("TSprite.ScaleEntity")
	c_TSprite *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_x,"x")
	DBG_LOCAL(t_y,"y")
	DBG_LOCAL(t_z,"z")
	DBG_LOCAL(t_glob,"glob")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsprite.monkey<178>");
	p_ScaleSprite(t_x,t_y);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsprite.monkey<179>");
	c_TEntity* t_=(this);
	return t_;
}
c_Matrix* c_TSprite::m_temp_mat;
int c_TSprite::p_Update2(c_TCamera* t_cam){
	DBG_ENTER("TSprite.Update")
	c_TSprite *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_cam,"cam")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsprite.monkey<199>");
	if(m_view_mode!=2){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsprite.monkey<201>");
		Float t_x=m_mat->m_grid.At(3).At(0);
		DBG_LOCAL(t_x,"x")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsprite.monkey<202>");
		Float t_y=m_mat->m_grid.At(3).At(1);
		DBG_LOCAL(t_y,"y")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsprite.monkey<203>");
		Float t_z=m_mat->m_grid.At(3).At(2);
		DBG_LOCAL(t_z,"z")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsprite.monkey<205>");
		m_temp_mat->p_Overwrite(t_cam->m_mat);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsprite.monkey<206>");
		m_temp_mat->m_grid.At(3).At(0)=t_x;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsprite.monkey<207>");
		m_temp_mat->m_grid.At(3).At(1)=t_y;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsprite.monkey<208>");
		m_temp_mat->m_grid.At(3).At(2)=t_z;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsprite.monkey<209>");
		m_mat_sp->p_Overwrite(m_temp_mat);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsprite.monkey<211>");
		if(m_angle!=FLOAT(0.0)){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsprite.monkey<212>");
			m_mat_sp->p_RotateRoll(m_angle);
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsprite.monkey<215>");
		if(m_scale_x!=FLOAT(1.0) || m_scale_y!=FLOAT(1.0)){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsprite.monkey<216>");
			m_mat_sp->p_Scale(m_scale_x,m_scale_y,FLOAT(1.0));
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsprite.monkey<219>");
		if(m_handle_x!=FLOAT(0.0) || m_handle_y!=FLOAT(0.0)){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsprite.monkey<220>");
			m_mat_sp->p_Translate(-m_handle_x,-m_handle_y,FLOAT(0.0));
		}
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsprite.monkey<225>");
		m_mat_sp->p_Overwrite(m_mat);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsprite.monkey<227>");
		if(m_scale_x!=FLOAT(1.0) || m_scale_y!=FLOAT(1.0)){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsprite.monkey<228>");
			m_mat_sp->p_Scale(m_scale_x,m_scale_y,FLOAT(1.0));
		}
	}
	return 0;
}
void c_TSprite::mark(){
	c_TMesh::mark();
	gc_mark_q(m_pixel_scale);
	gc_mark_q(m_mat_sp);
}
String c_TSprite::debug(){
	String t="(TSprite)\n";
	t=c_TMesh::debug()+t;
	t+=dbg_decl("angle",&m_angle);
	t+=dbg_decl("scale_x",&m_scale_x);
	t+=dbg_decl("scale_y",&m_scale_y);
	t+=dbg_decl("handle_x",&m_handle_x);
	t+=dbg_decl("handle_y",&m_handle_y);
	t+=dbg_decl("view_mode",&m_view_mode);
	t+=dbg_decl("mat_sp",&m_mat_sp);
	t+=dbg_decl("pixel_scale",&m_pixel_scale);
	t+=dbg_decl("temp_mat",&c_TSprite::m_temp_mat);
	return t;
}
int bb_functions_RenderWorld(){
	DBG_ENTER("RenderWorld")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/functions.monkey<1144>");
	c_TRender::m_RenderWorld();
	return 0;
}
c_CalLoaderHandler::c_CalLoaderHandler(){
	m_LoaderCallbacks=0;
}
c_CalLoaderHandler* c_CalLoaderHandler::m_new(){
	DBG_ENTER("CalLoaderHandler.new")
	c_CalLoaderHandler *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<42>");
	gc_assign(m_LoaderCallbacks,(new c_List8)->m_new());
	return this;
}
int c_CalLoaderHandler::p_LoadFile(String t_url,int t_type,c_CalLoader* t_loader,String t_data){
	DBG_ENTER("CalLoaderHandler.LoadFile")
	c_CalLoaderHandler *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_url,"url")
	DBG_LOCAL(t_type,"type")
	DBG_LOCAL(t_loader,"loader")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<47>");
	c_CalLoadingCallback* t_callback=(new c_CalLoadingCallback)->m_new();
	DBG_LOCAL(t_callback,"callback")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<48>");
	t_callback->p_SetLoader(t_loader);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<49>");
	t_callback->p_Load(t_type,t_url,t_data,String(L"text/plain;charset=utf-8",24),String(L"utf8",4));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<50>");
	m_LoaderCallbacks->p_AddLast8(t_callback);
	return 0;
}
bool c_CalLoaderHandler::p_IsFileLoaded(String t_url){
	DBG_ENTER("CalLoaderHandler.IsFileLoaded")
	c_CalLoaderHandler *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_url,"url")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<77>");
	c_Enumerator13* t_=m_LoaderCallbacks->p_ObjectEnumerator();
	while(t_->p_HasNext()){
		DBG_BLOCK();
		c_CalLoadingCallback* t_callback=t_->p_NextObject();
		DBG_LOCAL(t_callback,"callback")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<78>");
		if(t_callback->m_fileurl==t_url && t_callback->p_IsFinished()==true && t_callback->m_loader->p_IsLoaded2()==true){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<79>");
			return true;
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<82>");
	return false;
}
Object* c_CalLoaderHandler::p_GetLoadedFile(String t_url,bool t_keepinlist){
	DBG_ENTER("CalLoaderHandler.GetLoadedFile")
	c_CalLoaderHandler *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_url,"url")
	DBG_LOCAL(t_keepinlist,"keepinlist")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<86>");
	c_Enumerator13* t_=m_LoaderCallbacks->p_ObjectEnumerator();
	while(t_->p_HasNext()){
		DBG_BLOCK();
		c_CalLoadingCallback* t_callback=t_->p_NextObject();
		DBG_LOCAL(t_callback,"callback")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<87>");
		if(t_callback->m_fileurl==t_url && t_callback->p_IsFinished()==true && t_callback->m_loader->p_IsLoaded2()==true){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<88>");
			if(t_keepinlist==false){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<89>");
				m_LoaderCallbacks->p_Remove3(t_callback);
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<91>");
			Object* t_2=t_callback->p_GetLoadedObject();
			return t_2;
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<94>");
	return 0;
}
int c_CalLoaderHandler::p_Update(){
	DBG_ENTER("CalLoaderHandler.Update")
	c_CalLoaderHandler *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<68>");
	c_Enumerator13* t_=m_LoaderCallbacks->p_ObjectEnumerator();
	while(t_->p_HasNext()){
		DBG_BLOCK();
		c_CalLoadingCallback* t_callback=t_->p_NextObject();
		DBG_LOCAL(t_callback,"callback")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<69>");
		t_callback->p_Update();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<70>");
		if(t_callback->p_IsFinished()==true && t_callback->m_loader->p_IsLoaded2()==false){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<71>");
			t_callback->m_loader->p_Load2(t_callback->m_data);
		}
	}
	return 0;
}
void c_CalLoaderHandler::mark(){
	Object::mark();
	gc_mark_q(m_LoaderCallbacks);
}
String c_CalLoaderHandler::debug(){
	String t="(CalLoaderHandler)\n";
	t+=dbg_decl("LoaderCallbacks",&m_LoaderCallbacks);
	return t;
}
c_CalLoadingCallback::c_CalLoadingCallback(){
	m_loader=0;
	m_fileurl=String();
	m_get_req=0;
	m_hasheader=false;
	m_headername=String();
	m_headerval=String();
	m_post_req=0;
	m_finished=false;
	m_bytesrec=0;
	m_data=String();
}
c_CalLoadingCallback* c_CalLoadingCallback::m_new(){
	DBG_ENTER("CalLoadingCallback.new")
	c_CalLoadingCallback *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<101>");
	return this;
}
void c_CalLoadingCallback::p_SetLoader(c_CalLoader* t_loadr){
	DBG_ENTER("CalLoadingCallback.SetLoader")
	c_CalLoadingCallback *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_loadr,"loadr")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<120>");
	gc_assign(m_loader,t_loadr);
}
void c_CalLoadingCallback::p_Load(int t_type,String t_url,String t_data,String t_mime,String t_enc){
	DBG_ENTER("CalLoadingCallback.Load")
	c_CalLoadingCallback *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_type,"type")
	DBG_LOCAL(t_url,"url")
	DBG_LOCAL(t_data,"data")
	DBG_LOCAL(t_mime,"mime")
	DBG_LOCAL(t_enc,"enc")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<181>");
	m_fileurl=t_url;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<182>");
	bbPrint(String(L"Loading: ",9)+t_url);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<183>");
	int t_1=t_type;
	DBG_LOCAL(t_1,"1")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<186>");
	if(t_1==0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<187>");
		gc_assign(m_get_req,(new c_HttpRequest)->m_new2(String(L"GET",3),t_url,(this)));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<188>");
		if(m_hasheader==true){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<189>");
			m_get_req->p_SetHeader(m_headername,m_headerval);
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<191>");
		if(t_data!=String()){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<192>");
			m_get_req->p_Send2(t_data,t_mime,t_enc);
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<194>");
			m_get_req->p_Send();
		}
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<197>");
		if(t_1==1){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<198>");
			gc_assign(m_post_req,(new c_HttpRequest)->m_new2(String(L"POST",4),t_url,(this)));
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<199>");
			if(m_hasheader==true){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<200>");
				m_post_req->p_SetHeader(m_headername,m_headerval);
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<202>");
			if(t_data!=String()){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<203>");
				m_post_req->p_Send2(t_data,t_mime,t_enc);
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<205>");
				m_post_req->p_Send();
			}
		}
	}
}
bool c_CalLoadingCallback::p_IsFinished(){
	DBG_ENTER("CalLoadingCallback.IsFinished")
	c_CalLoadingCallback *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<136>");
	return m_finished;
}
Object* c_CalLoadingCallback::p_GetLoadedObject(){
	DBG_ENTER("CalLoadingCallback.GetLoadedObject")
	c_CalLoadingCallback *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<116>");
	Object* t_=m_loader->p_GetLoadedObject();
	return t_;
}
void c_CalLoadingCallback::p_Update(){
	DBG_ENTER("CalLoadingCallback.Update")
	c_CalLoadingCallback *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<168>");
	if(m_get_req!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<169>");
		m_bytesrec=m_get_req->p_BytesReceived();
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<171>");
	if(m_post_req!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<172>");
		m_bytesrec=m_post_req->p_BytesReceived();
	}
}
void c_CalLoadingCallback::p_OnHttpRequestComplete(c_HttpRequest* t_req){
	DBG_ENTER("CalLoadingCallback.OnHttpRequestComplete")
	c_CalLoadingCallback *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_req,"req")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<146>");
	bbPrint(String(L"Status: ",8)+String(t_req->p_Status()));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<147>");
	m_data=t_req->p_ResponseText();
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<148>");
	m_finished=true;
}
void c_CalLoadingCallback::mark(){
	Object::mark();
	gc_mark_q(m_loader);
	gc_mark_q(m_get_req);
	gc_mark_q(m_post_req);
}
String c_CalLoadingCallback::debug(){
	String t="(CalLoadingCallback)\n";
	t+=dbg_decl("get_req",&m_get_req);
	t+=dbg_decl("post_req",&m_post_req);
	t+=dbg_decl("hasheader",&m_hasheader);
	t+=dbg_decl("headername",&m_headername);
	t+=dbg_decl("headerval",&m_headerval);
	t+=dbg_decl("bytesrec",&m_bytesrec);
	t+=dbg_decl("data",&m_data);
	t+=dbg_decl("finished",&m_finished);
	t+=dbg_decl("fileurl",&m_fileurl);
	t+=dbg_decl("loader",&m_loader);
	return t;
}
c_List8::c_List8(){
	m__head=((new c_HeadNode8)->m_new());
}
c_List8* c_List8::m_new(){
	DBG_ENTER("List.new")
	c_List8 *self=this;
	DBG_LOCAL(self,"Self")
	return this;
}
c_Node10* c_List8::p_AddLast8(c_CalLoadingCallback* t_data){
	DBG_ENTER("List.AddLast")
	c_List8 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<108>");
	c_Node10* t_=(new c_Node10)->m_new(m__head,m__head->m__pred,t_data);
	return t_;
}
c_List8* c_List8::m_new2(Array<c_CalLoadingCallback* > t_data){
	DBG_ENTER("List.new")
	c_List8 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<13>");
	Array<c_CalLoadingCallback* > t_=t_data;
	int t_2=0;
	while(t_2<t_.Length()){
		DBG_BLOCK();
		c_CalLoadingCallback* t_t=t_.At(t_2);
		t_2=t_2+1;
		DBG_LOCAL(t_t,"t")
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<14>");
		p_AddLast8(t_t);
	}
	return this;
}
c_Enumerator13* c_List8::p_ObjectEnumerator(){
	DBG_ENTER("List.ObjectEnumerator")
	c_List8 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<186>");
	c_Enumerator13* t_=(new c_Enumerator13)->m_new(this);
	return t_;
}
bool c_List8::p_Equals2(c_CalLoadingCallback* t_lhs,c_CalLoadingCallback* t_rhs){
	DBG_ENTER("List.Equals")
	c_List8 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_lhs,"lhs")
	DBG_LOCAL(t_rhs,"rhs")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<28>");
	bool t_=t_lhs==t_rhs;
	return t_;
}
int c_List8::p_RemoveEach2(c_CalLoadingCallback* t_value){
	DBG_ENTER("List.RemoveEach")
	c_List8 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_value,"value")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<151>");
	c_Node10* t_node=m__head->m__succ;
	DBG_LOCAL(t_node,"node")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<152>");
	while(t_node!=m__head){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<153>");
		c_Node10* t_succ=t_node->m__succ;
		DBG_LOCAL(t_succ,"succ")
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<154>");
		if(p_Equals2(t_node->m__data,t_value)){
			DBG_BLOCK();
			t_node->p_Remove();
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<155>");
		t_node=t_succ;
	}
	return 0;
}
void c_List8::p_Remove3(c_CalLoadingCallback* t_value){
	DBG_ENTER("List.Remove")
	c_List8 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_value,"value")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<137>");
	p_RemoveEach2(t_value);
}
void c_List8::mark(){
	Object::mark();
	gc_mark_q(m__head);
}
String c_List8::debug(){
	String t="(List)\n";
	t+=dbg_decl("_head",&m__head);
	return t;
}
c_Node10::c_Node10(){
	m__succ=0;
	m__pred=0;
	m__data=0;
}
c_Node10* c_Node10::m_new(c_Node10* t_succ,c_Node10* t_pred,c_CalLoadingCallback* t_data){
	DBG_ENTER("Node.new")
	c_Node10 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_succ,"succ")
	DBG_LOCAL(t_pred,"pred")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<261>");
	gc_assign(m__succ,t_succ);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<262>");
	gc_assign(m__pred,t_pred);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<263>");
	gc_assign(m__succ->m__pred,this);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<264>");
	gc_assign(m__pred->m__succ,this);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<265>");
	gc_assign(m__data,t_data);
	return this;
}
c_Node10* c_Node10::m_new2(){
	DBG_ENTER("Node.new")
	c_Node10 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<258>");
	return this;
}
int c_Node10::p_Remove(){
	DBG_ENTER("Node.Remove")
	c_Node10 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<274>");
	if(m__succ->m__pred!=this){
		DBG_BLOCK();
		bbError(String(L"Illegal operation on removed node",33));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<276>");
	gc_assign(m__succ->m__pred,m__pred);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<277>");
	gc_assign(m__pred->m__succ,m__succ);
	return 0;
}
void c_Node10::mark(){
	Object::mark();
	gc_mark_q(m__succ);
	gc_mark_q(m__pred);
	gc_mark_q(m__data);
}
String c_Node10::debug(){
	String t="(Node)\n";
	t+=dbg_decl("_succ",&m__succ);
	t+=dbg_decl("_pred",&m__pred);
	t+=dbg_decl("_data",&m__data);
	return t;
}
c_HeadNode8::c_HeadNode8(){
}
c_HeadNode8* c_HeadNode8::m_new(){
	DBG_ENTER("HeadNode.new")
	c_HeadNode8 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<310>");
	c_Node10::m_new2();
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<311>");
	gc_assign(m__succ,(this));
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<312>");
	gc_assign(m__pred,(this));
	return this;
}
void c_HeadNode8::mark(){
	c_Node10::mark();
}
String c_HeadNode8::debug(){
	String t="(HeadNode)\n";
	t=c_Node10::debug()+t;
	return t;
}
c_CalLoader::c_CalLoader(){
	m_loaded=false;
	m_loadedobject=0;
}
c_CalLoader* c_CalLoader::m_new(){
	DBG_ENTER("CalLoader.new")
	c_CalLoader *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<5>");
	return this;
}
bool c_CalLoader::p_IsLoaded2(){
	DBG_ENTER("CalLoader.IsLoaded")
	c_CalLoader *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<18>");
	return m_loaded;
}
Object* c_CalLoader::p_GetLoadedObject(){
	DBG_ENTER("CalLoader.GetLoadedObject")
	c_CalLoader *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<22>");
	return m_loadedobject;
}
Object* c_CalLoader::p_Load2(String t_data){
	DBG_ENTER("CalLoader.Load")
	c_CalLoader *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<12>");
	gc_assign(m_loadedobject,(new Object));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<13>");
	m_loaded=true;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/loader.monkey<14>");
	return m_loadedobject;
}
void c_CalLoader::mark(){
	Object::mark();
	gc_mark_q(m_loadedobject);
}
String c_CalLoader::debug(){
	String t="(CalLoader)\n";
	t+=dbg_decl("loadedobject",&m_loadedobject);
	t+=dbg_decl("loaded",&m_loaded);
	return t;
}
c_SKNCalSkeletonLoader::c_SKNCalSkeletonLoader(){
}
c_SKNCalSkeletonLoader* c_SKNCalSkeletonLoader::m_new(){
	DBG_ENTER("SKNCalSkeletonLoader.new")
	c_SKNCalSkeletonLoader *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<292>");
	c_CalLoader::m_new();
	return this;
}
Object* c_SKNCalSkeletonLoader::p_Load2(String t_data){
	DBG_ENTER("SKNCalSkeletonLoader.Load")
	c_SKNCalSkeletonLoader *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<295>");
	bool t_isimvu=false;
	DBG_LOCAL(t_isimvu,"isimvu")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<296>");
	c_XMLError* t_error=(new c_XMLError)->m_new();
	DBG_LOCAL(t_error,"error")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<297>");
	c_XMLDoc* t_doc=bb_xml_ParseXML(t_data,t_error,1);
	DBG_LOCAL(t_doc,"doc")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<298>");
	if(t_doc==0 && t_error->m_error){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<299>");
		bbPrint(t_error->p_ToString());
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<300>");
		m_loaded=true;
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<301>");
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<304>");
	c_XMLNode* t_skeletonElem=(t_doc);
	DBG_LOCAL(t_skeletonElem,"skeletonElem")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<306>");
	if(t_skeletonElem==0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<307>");
		bbPrint(String(L"Skeleton Node not found!",24));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<308>");
		m_loaded=true;
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<309>");
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<312>");
	if(t_skeletonElem->m_name!=String(L"skeleton",8)){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<313>");
		if(t_skeletonElem->m_name==String(L"header",6)){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<314>");
			t_skeletonElem=t_skeletonElem->p_GetChild(false);
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<315>");
			t_isimvu=true;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<316>");
			if(t_skeletonElem->m_name!=String(L"skeleton",8)){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<317>");
				bbPrint(String(L"Wrong Start Node: ",18)+t_skeletonElem->m_name);
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<318>");
				m_loaded=true;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<319>");
				return 0;
			}
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<322>");
			bbPrint(String(L"Wrong Start Node: ",18)+t_skeletonElem->m_name);
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<323>");
			m_loaded=true;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<324>");
			return 0;
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<328>");
	if(t_skeletonElem->p_GetXMLAttribute(String(L"version",7))->m_value!=String(L"1000",4) && t_isimvu==false){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<329>");
		bbPrint(String(L"Wrong Version: ",15)+t_skeletonElem->p_GetXMLAttribute(String(L"version",7))->m_value);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<330>");
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<333>");
	c_CalCoreSkeleton* t_coreSkeleton=(new c_CalCoreSkeleton)->m_new();
	DBG_LOCAL(t_coreSkeleton,"coreSkeleton")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<334>");
	int t_boneCount=(t_skeletonElem->p_GetXMLAttribute(String(L"numbones",8))->m_value).ToInt();
	DBG_LOCAL(t_boneCount,"boneCount")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<335>");
	c_List13* t_boneids=t_skeletonElem->p_GetChildren2(String(L"bone",4),0,false);
	DBG_LOCAL(t_boneids,"boneids")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<338>");
	c_Enumerator15* t_=t_boneids->p_ObjectEnumerator();
	while(t_->p_HasNext()){
		DBG_BLOCK();
		c_XMLNode* t_boneElem=t_->p_NextObject();
		DBG_LOCAL(t_boneElem,"boneElem")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<339>");
		String t_name=t_boneElem->p_GetXMLAttribute(String(L"name",4))->m_value;
		DBG_LOCAL(t_name,"name")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<341>");
		c_XMLNode* t_translationElem=t_boneElem->p_GetChild2(String(L"translation",11),false);
		DBG_LOCAL(t_translationElem,"translationElem")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<342>");
		if(t_translationElem==0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<343>");
			bbPrint(String(L"No Translation bone data",24));
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<344>");
			return 0;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<347>");
		Array<String > t_r=t_translationElem->m_value.Split(String(L" ",1));
		DBG_LOCAL(t_r,"r")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<348>");
		Float t_tx=FLOAT(.0);
		Float t_ty=FLOAT(.0);
		Float t_tz=FLOAT(.0);
		DBG_LOCAL(t_tx,"tx")
		DBG_LOCAL(t_ty,"ty")
		DBG_LOCAL(t_tz,"tz")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<349>");
		t_tx=(t_r.At(0)).ToFloat();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<350>");
		t_ty=(t_r.At(1)).ToFloat();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<351>");
		t_tz=(t_r.At(2)).ToFloat();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<353>");
		c_XMLNode* t_rotationElem=t_boneElem->p_GetChild2(String(L"rotation",8),false);
		DBG_LOCAL(t_rotationElem,"rotationElem")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<354>");
		if(t_rotationElem==0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<355>");
			bbPrint(String(L"No Rotation bone data",21));
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<356>");
			return 0;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<359>");
		Array<String > t_rr=t_rotationElem->m_value.Split(String(L" ",1));
		DBG_LOCAL(t_rr,"rr")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<360>");
		Float t_rx=FLOAT(.0);
		Float t_ry=FLOAT(.0);
		Float t_rz=FLOAT(.0);
		Float t_rw=FLOAT(.0);
		DBG_LOCAL(t_rx,"rx")
		DBG_LOCAL(t_ry,"ry")
		DBG_LOCAL(t_rz,"rz")
		DBG_LOCAL(t_rw,"rw")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<362>");
		t_rx=(t_rr.At(0)).ToFloat();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<363>");
		t_ry=(t_rr.At(1)).ToFloat();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<364>");
		t_rz=(t_rr.At(2)).ToFloat();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<365>");
		t_rw=(t_rr.At(3)).ToFloat();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<367>");
		c_XMLNode* t_translationBoneSpaceElem=t_boneElem->p_GetChild2(String(L"localtranslation",16),false);
		DBG_LOCAL(t_translationBoneSpaceElem,"translationBoneSpaceElem")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<369>");
		if(t_translationBoneSpaceElem==0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<370>");
			bbPrint(String(L"No Local Translation bone data",30));
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<371>");
			return 0;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<375>");
		Float t_txBoneSpace=FLOAT(.0);
		Float t_tyBoneSpace=FLOAT(.0);
		Float t_tzBoneSpace=FLOAT(.0);
		DBG_LOCAL(t_txBoneSpace,"txBoneSpace")
		DBG_LOCAL(t_tyBoneSpace,"tyBoneSpace")
		DBG_LOCAL(t_tzBoneSpace,"tzBoneSpace")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<376>");
		Array<String > t_tl=t_translationBoneSpaceElem->m_value.Split(String(L" ",1));
		DBG_LOCAL(t_tl,"tl")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<378>");
		t_txBoneSpace=(t_tl.At(0)).ToFloat();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<379>");
		t_tyBoneSpace=(t_tl.At(1)).ToFloat();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<380>");
		t_tzBoneSpace=(t_tl.At(2)).ToFloat();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<383>");
		c_XMLNode* t_rotationBoneSpaceElem=t_boneElem->p_GetChild2(String(L"localrotation",13),false);
		DBG_LOCAL(t_rotationBoneSpaceElem,"rotationBoneSpaceElem")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<385>");
		if(t_rotationBoneSpaceElem==0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<386>");
			bbPrint(String(L"No Local Rotation bone data",27));
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<387>");
			return 0;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<390>");
		Array<String > t_lr=t_rotationBoneSpaceElem->m_value.Split(String(L" ",1));
		DBG_LOCAL(t_lr,"lr")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<391>");
		Float t_rxBoneSpace=FLOAT(.0);
		Float t_ryBoneSpace=FLOAT(.0);
		Float t_rzBoneSpace=FLOAT(.0);
		Float t_rwBoneSpace=FLOAT(.0);
		DBG_LOCAL(t_rxBoneSpace,"rxBoneSpace")
		DBG_LOCAL(t_ryBoneSpace,"ryBoneSpace")
		DBG_LOCAL(t_rzBoneSpace,"rzBoneSpace")
		DBG_LOCAL(t_rwBoneSpace,"rwBoneSpace")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<393>");
		t_rxBoneSpace=(t_lr.At(0)).ToFloat();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<394>");
		t_ryBoneSpace=(t_lr.At(1)).ToFloat();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<395>");
		t_rzBoneSpace=(t_lr.At(2)).ToFloat();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<396>");
		t_rwBoneSpace=(t_lr.At(3)).ToFloat();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<398>");
		c_XMLNode* t_parentElem=t_boneElem->p_GetChild2(String(L"parentid",8),false);
		DBG_LOCAL(t_parentElem,"parentElem")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<400>");
		int t_parentId=(t_parentElem->m_value).ToInt();
		DBG_LOCAL(t_parentId,"parentId")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<402>");
		c_CalCoreBone* t_coreBone=(new c_CalCoreBone)->m_new(t_name);
		DBG_LOCAL(t_coreBone,"coreBone")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<403>");
		t_coreBone->p_setParentId(t_parentId);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<405>");
		c_CalVector* t_trans=(new c_CalVector)->m_new3(t_tx,t_ty,t_tz);
		DBG_LOCAL(t_trans,"trans")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<406>");
		c_CalQuaternion* t_rot=(new c_CalQuaternion)->m_new3(t_rx,t_ry,t_rz,t_rw);
		DBG_LOCAL(t_rot,"rot")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<408>");
		t_coreBone->p_setTranslation(t_trans);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<409>");
		t_coreBone->p_setRotation(t_rot);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<411>");
		t_coreBone->p_setTranslationBoneSpace((new c_CalVector)->m_new3(t_txBoneSpace,t_tyBoneSpace,t_tzBoneSpace));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<412>");
		t_coreBone->p_setRotationBoneSpace((new c_CalQuaternion)->m_new3(t_rxBoneSpace,t_ryBoneSpace,t_rzBoneSpace,t_rwBoneSpace));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<414>");
		c_List13* t_childids=t_boneElem->p_GetChildren2(String(L"childid",7),0,false);
		DBG_LOCAL(t_childids,"childids")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<415>");
		c_Enumerator15* t_2=t_childids->p_ObjectEnumerator();
		while(t_2->p_HasNext()){
			DBG_BLOCK();
			c_XMLNode* t_childElem=t_2->p_NextObject();
			DBG_LOCAL(t_childElem,"childElem")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<419>");
			int t_childId=(t_childElem->m_value).ToInt();
			DBG_LOCAL(t_childId,"childId")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<420>");
			t_coreBone->p_addChildId(t_childId);
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<424>");
		t_coreBone->p_setCoreSkeleton(t_coreSkeleton);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<425>");
		t_coreSkeleton->p_addCoreBone(t_coreBone);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<429>");
	t_coreSkeleton->p_calculateState();
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<431>");
	gc_assign(m_loadedobject,(t_coreSkeleton));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<432>");
	m_loaded=true;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<433>");
	return m_loadedobject;
}
void c_SKNCalSkeletonLoader::mark(){
	c_CalLoader::mark();
}
String c_SKNCalSkeletonLoader::debug(){
	String t="(SKNCalSkeletonLoader)\n";
	t=c_CalLoader::debug()+t;
	return t;
}
c_HttpRequest::c_HttpRequest(){
	m__req=String();
	m__url=0;
	m__onComplete=0;
	m__data=0;
	m__dataLength=0;
	m__status=0;
	m__response=0;
	m__responseText=String();
	m__bytesReceived=0;
	m__header=0;
	m__sock=0;
	m__wbuf=(new c_DataBuffer)->m_new(4096);
	m__rbuf=(new c_DataBuffer)->m_new(16384);
}
c_HttpRequest* c_HttpRequest::m_new(){
	DBG_ENTER("HttpRequest.new")
	c_HttpRequest *self=this;
	DBG_LOCAL(self,"Self")
	return this;
}
void c_HttpRequest::p_Open(String t_req,String t_url,c_IOnHttpRequestComplete* t_onComplete){
	DBG_ENTER("HttpRequest.Open")
	c_HttpRequest *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_req,"req")
	DBG_LOCAL(t_url,"url")
	DBG_LOCAL(t_onComplete,"onComplete")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<127>");
	m__req=t_req;
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<128>");
	gc_assign(m__url,(new c_Url)->m_new(t_url,String(L"http",4),80));
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<129>");
	gc_assign(m__onComplete,t_onComplete);
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<130>");
	m__data=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<131>");
	m__dataLength=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<132>");
	m__status=-1;
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<133>");
	m__response=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<134>");
	m__responseText=String();
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<135>");
	m__bytesReceived=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<136>");
	gc_assign(m__header,(new c_StringStack)->m_new2());
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<137>");
	m__header->p_Push10(m__req+String(L" /",2)+m__url->p_FullPath()+String(L" HTTP/1.0",9));
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<138>");
	m__header->p_Push10(String(L"Host: ",6)+m__url->p_Domain());
}
c_HttpRequest* c_HttpRequest::m_new2(String t_req,String t_url,c_IOnHttpRequestComplete* t_onComplete){
	DBG_ENTER("HttpRequest.new")
	c_HttpRequest *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_req,"req")
	DBG_LOCAL(t_url,"url")
	DBG_LOCAL(t_onComplete,"onComplete")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<114>");
	p_Open(t_req,t_url,t_onComplete);
	return this;
}
void c_HttpRequest::p_SetHeader(String t_name,String t_value){
	DBG_ENTER("HttpRequest.SetHeader")
	c_HttpRequest *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_name,"name")
	DBG_LOCAL(t_value,"value")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<142>");
	m__header->p_Push10(t_name+String(L": ",2)+t_value);
}
void c_HttpRequest::p_Send(){
	DBG_ENTER("HttpRequest.Send")
	c_HttpRequest *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<146>");
	gc_assign(m__sock,(new c_Socket)->m_new(String(L"stream",6)));
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<147>");
	m__sock->p_ConnectAsync(m__url->p_Domain(),m__url->p_Port(),(this));
}
void c_HttpRequest::p_Send2(String t_data,String t_mimeType,String t_encoding){
	DBG_ENTER("HttpRequest.Send")
	c_HttpRequest *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_LOCAL(t_mimeType,"mimeType")
	DBG_LOCAL(t_encoding,"encoding")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<151>");
	gc_assign(m__data,(new c_DataBuffer)->m_new(t_data.Length()*3));
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<152>");
	m__dataLength=m__data->p_PokeString(0,t_data,t_encoding);
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<153>");
	if((t_mimeType).Length()!=0){
		DBG_BLOCK();
		m__header->p_Push10(String(L"Content-Type: ",14)+t_mimeType);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<154>");
	m__header->p_Push10(String(L"Content-Length: ",16)+String(m__dataLength));
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<155>");
	p_Send();
}
int c_HttpRequest::p_BytesReceived(){
	DBG_ENTER("HttpRequest.BytesReceived")
	c_HttpRequest *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<167>");
	return m__bytesReceived;
}
void c_HttpRequest::p_Finish(){
	DBG_ENTER("HttpRequest.Finish")
	c_HttpRequest *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<188>");
	m__sock->p_Close();
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<189>");
	if((m__response)!=0){
		DBG_BLOCK();
		m__responseText=m__response->p_Join(String());
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<190>");
	m__onComplete->p_OnHttpRequestComplete(this);
}
void c_HttpRequest::p_OnConnectComplete(bool t_connected,c_Socket* t_source){
	DBG_ENTER("HttpRequest.OnConnectComplete")
	c_HttpRequest *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_connected,"connected")
	DBG_LOCAL(t_source,"source")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<194>");
	if(!t_connected){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<195>");
		p_Finish();
		return;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<199>");
	m__header->p_Push10(String());
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<200>");
	m__header->p_Push10(String());
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<202>");
	String t_t=m__header->p_Join(String(L"\r\n",2));
	DBG_LOCAL(t_t,"t")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<203>");
	int t_n=m__wbuf->p_PokeString(0,t_t,String(L"ascii",5));
	DBG_LOCAL(t_n,"n")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<205>");
	m__header->p_Clear();
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<206>");
	m__sock->p_SendAsync(m__wbuf,0,t_n,(this));
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<207>");
	m__sock->p_ReceiveAsync(m__rbuf,0,m__rbuf->Length(),(this));
}
int c_HttpRequest::p_Status(){
	DBG_ENTER("HttpRequest.Status")
	c_HttpRequest *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<159>");
	return m__status;
}
String c_HttpRequest::p_ResponseText(){
	DBG_ENTER("HttpRequest.ResponseText")
	c_HttpRequest *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<163>");
	return m__responseText;
}
void c_HttpRequest::p_OnReceiveComplete(c_DataBuffer* t_buf,int t_offset,int t_count,c_Socket* t_source){
	DBG_ENTER("HttpRequest.OnReceiveComplete")
	c_HttpRequest *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_buf,"buf")
	DBG_LOCAL(t_offset,"offset")
	DBG_LOCAL(t_count,"count")
	DBG_LOCAL(t_source,"source")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<212>");
	if(!((t_count)!=0)){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<213>");
		p_Finish();
		return;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<218>");
	if((m__response)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<219>");
		m__bytesReceived+=t_count;
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<220>");
		m__response->p_Push10(t_buf->p_PeekString(t_offset,t_count,String(L"utf8",4)));
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<221>");
		m__sock->p_ReceiveAsync(t_buf,0,t_buf->Length(),(this));
		return;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<225>");
	int t_start=0;
	DBG_LOCAL(t_start,"start")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<226>");
	int t_i=t_offset;
	DBG_LOCAL(t_i,"i")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<227>");
	int t_term=t_i+t_count;
	DBG_LOCAL(t_term,"term")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<229>");
	while(t_i<t_term){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<231>");
		t_i+=1;
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<232>");
		if(t_buf->PeekByte(t_i-1)!=10){
			DBG_BLOCK();
			continue;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<234>");
		int t_len=t_i-t_start-1;
		DBG_LOCAL(t_len,"len")
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<235>");
		String t_t=t_buf->p_PeekString(t_start,t_len,String(L"ascii",5)).Trim();
		DBG_LOCAL(t_t,"t")
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<236>");
		t_start=t_i;
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<238>");
		if((t_t).Length()!=0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<239>");
			m__header->p_Push10(t_t);
			DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<240>");
			continue;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<243>");
		if((m__header->p_Length2())!=0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<244>");
			Array<String > t_bits=m__header->p_Get(0).ToUpper().Split(String(L" ",1));
			DBG_LOCAL(t_bits,"bits")
			DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<245>");
			if(t_bits.Length()>2 && t_bits.At(0).StartsWith(String(L"HTTP/",5))){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<246>");
				m__status=(t_bits.At(1)).ToInt();
				DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<247>");
				gc_assign(m__response,(new c_StringStack)->m_new2());
				DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<248>");
				if(t_start<t_term){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<249>");
					m__bytesReceived+=t_term-t_start;
					DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<250>");
					m__response->p_Push10(t_buf->p_PeekString(t_start,t_term-t_start,String(L"utf8",4)));
				}
				DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<252>");
				m__sock->p_ReceiveAsync(t_buf,0,t_buf->Length(),(this));
				return;
			}
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<258>");
		p_Finish();
		return;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<263>");
	int t_n=t_term-t_start;
	DBG_LOCAL(t_n,"n")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<264>");
	if((t_start)!=0){
		DBG_BLOCK();
		t_buf->p_CopyBytes(t_start,t_buf,0,t_n);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<265>");
	m__sock->p_ReceiveAsync(t_buf,t_n,t_buf->Length()-t_n,(this));
}
void c_HttpRequest::p_OnSendComplete(c_DataBuffer* t_buf,int t_offset,int t_count,c_Socket* t_source){
	DBG_ENTER("HttpRequest.OnSendComplete")
	c_HttpRequest *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_buf,"buf")
	DBG_LOCAL(t_offset,"offset")
	DBG_LOCAL(t_count,"count")
	DBG_LOCAL(t_source,"source")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<270>");
	if(!((m__dataLength)!=0)){
		DBG_BLOCK();
		return;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<271>");
	m__sock->p_SendAsync(m__data,0,m__dataLength,(this));
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/httprequest.monkey<272>");
	m__dataLength=0;
}
void c_HttpRequest::mark(){
	Object::mark();
	gc_mark_q(m__url);
	gc_mark_q(m__onComplete);
	gc_mark_q(m__data);
	gc_mark_q(m__response);
	gc_mark_q(m__header);
	gc_mark_q(m__sock);
	gc_mark_q(m__wbuf);
	gc_mark_q(m__rbuf);
}
String c_HttpRequest::debug(){
	String t="(HttpRequest)\n";
	t+=dbg_decl("_wbuf",&m__wbuf);
	t+=dbg_decl("_rbuf",&m__rbuf);
	t+=dbg_decl("_req",&m__req);
	t+=dbg_decl("_url",&m__url);
	t+=dbg_decl("_onComplete",&m__onComplete);
	t+=dbg_decl("_header",&m__header);
	t+=dbg_decl("_data",&m__data);
	t+=dbg_decl("_dataLength",&m__dataLength);
	t+=dbg_decl("_sock",&m__sock);
	t+=dbg_decl("_status",&m__status);
	t+=dbg_decl("_bytesReceived",&m__bytesReceived);
	t+=dbg_decl("_response",&m__response);
	t+=dbg_decl("_responseText",&m__responseText);
	return t;
}
c_Url::c_Url(){
	m__defaultScheme=String();
	m__defaultPort=0;
	m__url=String();
	m__scheme=String();
	m__username=String();
	m__password=String();
	m__domain=String();
	m__port=0;
	m__path=String();
	m__query=String();
	m__fragment=String();
}
void c_Url::p_Set2(String t_url){
	DBG_ENTER("Url.Set")
	c_Url *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_url,"url")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<11>");
	m__url=t_url;
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<12>");
	m__scheme=m__defaultScheme;
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<13>");
	m__username=String();
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<14>");
	m__password=String();
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<15>");
	m__domain=String();
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<16>");
	m__port=m__defaultPort;
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<17>");
	m__path=String(L"/",1);
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<18>");
	m__query=String();
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<19>");
	m__fragment=String();
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<22>");
	int t_pos1=0;
	DBG_LOCAL(t_pos1,"pos1")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<23>");
	int t_pos2=0;
	DBG_LOCAL(t_pos2,"pos2")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<24>");
	int t_cursor=0;
	DBG_LOCAL(t_cursor,"cursor")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<27>");
	int t_queryPos=t_url.Find(String(L"?",1),0);
	DBG_LOCAL(t_queryPos,"queryPos")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<28>");
	int t_anchorPos=t_url.Find(String(L"#",1),0);
	DBG_LOCAL(t_anchorPos,"anchorPos")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<31>");
	int t_nonDataLength=0;
	DBG_LOCAL(t_nonDataLength,"nonDataLength")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<32>");
	if(t_queryPos==-1 && t_anchorPos==-1){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<34>");
		t_nonDataLength=t_url.Length();
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<35>");
		if(t_queryPos>-1 && t_anchorPos>-1){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<36>");
			if(t_queryPos<t_anchorPos){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<38>");
				t_nonDataLength=t_queryPos;
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<41>");
				t_nonDataLength=t_anchorPos;
				DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<42>");
				t_queryPos=-1;
			}
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<44>");
			if(t_queryPos>-1){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<46>");
				t_nonDataLength=t_queryPos;
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<49>");
				t_nonDataLength=t_anchorPos;
			}
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<53>");
	t_pos1=t_url.Find(String(L"://",3),t_cursor);
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<54>");
	if(t_pos1>-1 && t_pos1<t_nonDataLength){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<55>");
		m__scheme=t_url.Slice(t_cursor,t_pos1);
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<57>");
		t_cursor=t_pos1+3;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<61>");
	t_pos1=t_url.Find(String(L"@",1),t_cursor);
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<62>");
	if(t_pos1>-1 && t_pos1<t_nonDataLength){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<64>");
		t_pos2=t_url.Find(String(L":",1),t_cursor);
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<65>");
		if(t_pos2>-1 && t_pos2<t_pos1){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<67>");
			m__username=t_url.Slice(t_cursor,t_pos2);
			DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<68>");
			m__password=t_url.Slice(t_pos2+1,t_pos1);
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<71>");
			m__username=t_url.Slice(t_cursor,t_pos1);
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<75>");
		t_cursor=t_pos1+1;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<79>");
	int t_portStart=t_url.Find(String(L":",1),t_cursor);
	DBG_LOCAL(t_portStart,"portStart")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<80>");
	int t_pathStart=t_url.Find(String(L"/",1),t_cursor);
	DBG_LOCAL(t_pathStart,"pathStart")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<81>");
	int t_serverLength=0;
	DBG_LOCAL(t_serverLength,"serverLength")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<84>");
	if(t_portStart>-1 && t_portStart>=t_nonDataLength){
		DBG_BLOCK();
		t_portStart=-1;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<85>");
	if(t_pathStart>-1 && t_pathStart>=t_nonDataLength){
		DBG_BLOCK();
		t_pathStart=-1;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<87>");
	if(t_portStart==-1 && t_pathStart==-1){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<89>");
		m__domain=t_url.Slice(t_cursor,t_nonDataLength);
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<90>");
		if(t_portStart>-1 && t_pathStart>-1){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<91>");
			if(t_portStart<t_pathStart){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<93>");
				m__domain=t_url.Slice(t_cursor,t_portStart);
				DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<94>");
				m__port=(t_url.Slice(t_portStart+1,t_pathStart)).ToInt();
				DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<95>");
				m__path=t_url.Slice(t_pathStart,t_nonDataLength);
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<98>");
				m__domain=t_url.Slice(t_cursor,t_pathStart);
				DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<99>");
				m__path=t_url.Slice(t_pathStart,t_nonDataLength);
			}
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<101>");
			if(t_portStart>-1){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<103>");
				m__domain=t_url.Slice(t_cursor,t_portStart);
				DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<104>");
				m__port=(t_url.Slice(t_portStart+1,t_nonDataLength)).ToInt();
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<107>");
				m__domain=t_url.Slice(t_cursor,t_pathStart);
				DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<108>");
				m__path=t_url.Slice(t_pathStart,t_nonDataLength);
			}
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<112>");
	if(t_queryPos>-1){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<113>");
		if(t_anchorPos>-1){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<115>");
			m__query=t_url.Slice(t_queryPos+1,t_anchorPos);
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<118>");
			m__query=t_url.Slice(t_queryPos+1);
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<123>");
	if(t_anchorPos>-1){
		DBG_BLOCK();
		m__fragment=t_url.Slice(t_anchorPos+1);
	}
}
c_Url* c_Url::m_new(String t_url,String t_defaultScheme,int t_defaultPort){
	DBG_ENTER("Url.new")
	c_Url *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_url,"url")
	DBG_LOCAL(t_defaultScheme,"defaultScheme")
	DBG_LOCAL(t_defaultPort,"defaultPort")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<5>");
	m__defaultScheme=t_defaultScheme;
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<6>");
	m__defaultPort=t_defaultPort;
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<7>");
	p_Set2(t_url);
	return this;
}
c_Url* c_Url::m_new2(){
	DBG_ENTER("Url.new")
	c_Url *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<2>");
	return this;
}
String c_Url::p_FullPath(){
	DBG_ENTER("Url.FullPath")
	c_Url *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<163>");
	String t_full=m__path;
	DBG_LOCAL(t_full,"full")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<164>");
	if((m__query).Length()!=0){
		DBG_BLOCK();
		t_full=t_full+(String(L"?",1)+m__query);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<165>");
	if((m__fragment).Length()!=0){
		DBG_BLOCK();
		t_full=t_full+(String(L"#",1)+m__fragment);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<166>");
	return t_full;
}
String c_Url::p_Domain(){
	DBG_ENTER("Url.Domain")
	c_Url *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<143>");
	return m__domain;
}
int c_Url::p_Port(){
	DBG_ENTER("Url.Port")
	c_Url *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/url.monkey<147>");
	return m__port;
}
void c_Url::mark(){
	Object::mark();
}
String c_Url::debug(){
	String t="(Url)\n";
	t+=dbg_decl("_url",&m__url);
	t+=dbg_decl("_scheme",&m__scheme);
	t+=dbg_decl("_username",&m__username);
	t+=dbg_decl("_password",&m__password);
	t+=dbg_decl("_domain",&m__domain);
	t+=dbg_decl("_port",&m__port);
	t+=dbg_decl("_path",&m__path);
	t+=dbg_decl("_query",&m__query);
	t+=dbg_decl("_fragment",&m__fragment);
	t+=dbg_decl("_defaultScheme",&m__defaultScheme);
	t+=dbg_decl("_defaultPort",&m__defaultPort);
	return t;
}
c_Stack4::c_Stack4(){
	m_data=Array<String >();
	m_length=0;
}
c_Stack4* c_Stack4::m_new(){
	DBG_ENTER("Stack.new")
	c_Stack4 *self=this;
	DBG_LOCAL(self,"Self")
	return this;
}
c_Stack4* c_Stack4::m_new2(Array<String > t_data){
	DBG_ENTER("Stack.new")
	c_Stack4 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<13>");
	gc_assign(this->m_data,t_data.Slice(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<14>");
	this->m_length=t_data.Length();
	return this;
}
void c_Stack4::p_Push10(String t_value){
	DBG_ENTER("Stack.Push")
	c_Stack4 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_value,"value")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<67>");
	if(m_length==m_data.Length()){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<68>");
		gc_assign(m_data,m_data.Resize(m_length*2+10));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<70>");
	m_data.At(m_length)=t_value;
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<71>");
	m_length+=1;
}
void c_Stack4::p_Push11(Array<String > t_values,int t_offset,int t_count){
	DBG_ENTER("Stack.Push")
	c_Stack4 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_values,"values")
	DBG_LOCAL(t_offset,"offset")
	DBG_LOCAL(t_count,"count")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<79>");
	for(int t_i=0;t_i<t_count;t_i=t_i+1){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<80>");
		p_Push10(t_values.At(t_offset+t_i));
	}
}
void c_Stack4::p_Push12(Array<String > t_values,int t_offset){
	DBG_ENTER("Stack.Push")
	c_Stack4 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_values,"values")
	DBG_LOCAL(t_offset,"offset")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<75>");
	p_Push11(t_values,t_offset,t_values.Length()-t_offset);
}
Array<String > c_Stack4::p_ToArray(){
	DBG_ENTER("Stack.ToArray")
	c_Stack4 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<18>");
	Array<String > t_t=Array<String >(m_length);
	DBG_LOCAL(t_t,"t")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<19>");
	for(int t_i=0;t_i<m_length;t_i=t_i+1){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<20>");
		t_t.At(t_i)=m_data.At(t_i);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<22>");
	return t_t;
}
String c_Stack4::m_NIL;
void c_Stack4::p_Clear(){
	DBG_ENTER("Stack.Clear")
	c_Stack4 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<34>");
	for(int t_i=0;t_i<m_length;t_i=t_i+1){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<35>");
		m_data.At(t_i)=m_NIL;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<37>");
	m_length=0;
}
void c_Stack4::p_Length(int t_newlength){
	DBG_ENTER("Stack.Length")
	c_Stack4 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_newlength,"newlength")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<41>");
	if(t_newlength<m_length){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<42>");
		for(int t_i=t_newlength;t_i<m_length;t_i=t_i+1){
			DBG_BLOCK();
			DBG_LOCAL(t_i,"i")
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<43>");
			m_data.At(t_i)=m_NIL;
		}
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<45>");
		if(t_newlength>m_data.Length()){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<46>");
			gc_assign(m_data,m_data.Resize(bb_math2_Max(m_length*2+10,t_newlength)));
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<48>");
	m_length=t_newlength;
}
int c_Stack4::p_Length2(){
	DBG_ENTER("Stack.Length")
	c_Stack4 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<52>");
	return m_length;
}
String c_Stack4::p_Get(int t_index){
	DBG_ENTER("Stack.Get")
	c_Stack4 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_index,"index")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<100>");
	return m_data.At(t_index);
}
void c_Stack4::mark(){
	Object::mark();
	gc_mark_q(m_data);
}
String c_Stack4::debug(){
	String t="(Stack)\n";
	t+=dbg_decl("NIL",&c_Stack4::m_NIL);
	t+=dbg_decl("data",&m_data);
	t+=dbg_decl("length",&m_length);
	return t;
}
c_StringStack::c_StringStack(){
}
c_StringStack* c_StringStack::m_new(Array<String > t_data){
	DBG_ENTER("StringStack.new")
	c_StringStack *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<351>");
	c_Stack4::m_new2(t_data);
	return this;
}
c_StringStack* c_StringStack::m_new2(){
	DBG_ENTER("StringStack.new")
	c_StringStack *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<348>");
	c_Stack4::m_new();
	return this;
}
String c_StringStack::p_Join(String t_separator){
	DBG_ENTER("StringStack.Join")
	c_StringStack *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_separator,"separator")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<355>");
	String t_=t_separator.Join(p_ToArray());
	return t_;
}
void c_StringStack::mark(){
	c_Stack4::mark();
}
String c_StringStack::debug(){
	String t="(StringStack)\n";
	t=c_Stack4::debug()+t;
	return t;
}
c_Socket::c_Socket(){
	m__sock=0;
	m__proto=0;
	m__state=0;
	m__rthread=0;
	m__wthread=0;
}
void c_Socket::p_Start(){
	DBG_ENTER("Socket.Start")
	c_Socket *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<564>");
	gc_assign(m__rthread,(new c_AsyncQueue)->m_new(this));
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<565>");
	gc_assign(m__wthread,(new c_AsyncQueue)->m_new(this));
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<566>");
	bb_asyncevent_AddAsyncEventSource(this);
}
c_Socket* c_Socket::m_new(String t_protocol){
	DBG_ENTER("Socket.new")
	c_Socket *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_protocol,"protocol")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<386>");
	int t_proto=0;
	DBG_LOCAL(t_proto,"proto")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<387>");
	String t_1=t_protocol;
	DBG_LOCAL(t_1,"1")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<388>");
	if(t_1==String(L"stream",6)){
		DBG_BLOCK();
		t_proto=1;
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<389>");
		if(t_1==String(L"server",6)){
			DBG_BLOCK();
			t_proto=2;
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<390>");
			if(t_1==String(L"datagram",8)){
				DBG_BLOCK();
				t_proto=3;
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<391>");
				bbError(String(L"Illegal socket protocol",23));
			}
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<393>");
	gc_assign(m__sock,(new BBSocket));
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<394>");
	if(!m__sock->Open(t_proto)){
		DBG_BLOCK();
		bbError(String(L"Socket open failed",18));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<395>");
	m__proto=t_proto;
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<396>");
	m__state=1;
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<397>");
	p_Start();
	return this;
}
c_Socket* c_Socket::m_new2(BBSocket* t_sock,int t_proto,int t_state){
	DBG_ENTER("Socket.new")
	c_Socket *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_sock,"sock")
	DBG_LOCAL(t_proto,"proto")
	DBG_LOCAL(t_state,"state")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<557>");
	gc_assign(m__sock,t_sock);
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<558>");
	m__proto=t_proto;
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<559>");
	m__state=t_state;
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<560>");
	p_Start();
	return this;
}
bool c_Socket::p_IsOpen(){
	DBG_ENTER("Socket.IsOpen")
	c_Socket *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<503>");
	bool t_=(m__state&1)!=0;
	return t_;
}
bool c_Socket::p_IsConnected(){
	DBG_ENTER("Socket.IsConnected")
	c_Socket *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<511>");
	bool t_=(m__state&4)!=0;
	return t_;
}
bool c_Socket::p_IsListening(){
	DBG_ENTER("Socket.IsListening")
	c_Socket *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<515>");
	bool t_=(m__state&8)!=0;
	return t_;
}
void c_Socket::p_ConnectAsync(String t_host,int t_port,c_IOnConnectComplete* t_onComplete){
	DBG_ENTER("Socket.ConnectAsync")
	c_Socket *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_host,"host")
	DBG_LOCAL(t_port,"port")
	DBG_LOCAL(t_onComplete,"onComplete")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<425>");
	if(!p_IsOpen() || p_IsConnected() || p_IsListening()){
		DBG_BLOCK();
		return;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<426>");
	m__rthread->p_Enqueue((new c_AsyncConnectOp)->m_new(m__sock,t_host,t_port,t_onComplete));
}
void c_Socket::p_UpdateAsyncEvents(){
	DBG_ENTER("Socket.UpdateAsyncEvents")
	c_Socket *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<570>");
	if((m__rthread)!=0){
		DBG_BLOCK();
		m__rthread->p_UpdateAsyncEvents();
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<571>");
	if((m__wthread)!=0){
		DBG_BLOCK();
		m__wthread->p_UpdateAsyncEvents();
	}
}
void c_Socket::p_OnConnectComplete2(){
	DBG_ENTER("Socket.OnConnectComplete")
	c_Socket *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<575>");
	m__state|=6;
}
void c_Socket::p_Close(){
	DBG_ENTER("Socket.Close")
	c_Socket *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<401>");
	m__sock->Close();
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<402>");
	m__state=0;
}
void c_Socket::p_SendAsync(c_DataBuffer* t_buf,int t_offset,int t_count,c_IOnSendComplete* t_onComplete){
	DBG_ENTER("Socket.SendAsync")
	c_Socket *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_buf,"buf")
	DBG_LOCAL(t_offset,"offset")
	DBG_LOCAL(t_count,"count")
	DBG_LOCAL(t_onComplete,"onComplete")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<448>");
	if(!p_IsConnected()){
		DBG_BLOCK();
		return;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<449>");
	m__wthread->p_Enqueue((new c_AsyncSendOp)->m_new(m__sock,t_buf,t_offset,t_count,t_onComplete));
}
void c_Socket::p_ReceiveAsync(c_DataBuffer* t_buf,int t_offset,int t_count,c_IOnReceiveComplete* t_onComplete){
	DBG_ENTER("Socket.ReceiveAsync")
	c_Socket *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_buf,"buf")
	DBG_LOCAL(t_offset,"offset")
	DBG_LOCAL(t_count,"count")
	DBG_LOCAL(t_onComplete,"onComplete")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<471>");
	if(!p_IsConnected()){
		DBG_BLOCK();
		return;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<472>");
	m__rthread->p_Enqueue((new c_AsyncReceiveOp)->m_new(m__sock,t_buf,t_offset,t_count,t_onComplete));
}
void c_Socket::mark(){
	Object::mark();
	gc_mark_q(m__sock);
	gc_mark_q(m__rthread);
	gc_mark_q(m__wthread);
}
String c_Socket::debug(){
	String t="(Socket)\n";
	t+=dbg_decl("_sock",&m__sock);
	t+=dbg_decl("_proto",&m__proto);
	t+=dbg_decl("_state",&m__state);
	t+=dbg_decl("_rthread",&m__rthread);
	t+=dbg_decl("_wthread",&m__wthread);
	return t;
}
c_Thread::c_Thread(){
}
c_Stack5* c_Thread::m__zombies;
c_Stack5* c_Thread::m__zombies2;
c_Stack5* c_Thread::m__alive;
c_Thread* c_Thread::m_new(){
	DBG_ENTER("Thread.new")
	c_Thread *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/thread.monkey<43>");
	c_Enumerator10* t_=m__zombies->p_ObjectEnumerator();
	while(t_->p_HasNext()){
		DBG_BLOCK();
		c_Thread* t_thread=t_->p_NextObject();
		DBG_LOCAL(t_thread,"thread")
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/thread.monkey<44>");
		if(t_thread->IsRunning()){
			DBG_BLOCK();
			m__zombies2->p_Push13(t_thread);
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/thread.monkey<46>");
	gc_assign(m__zombies,m__zombies2);
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/thread.monkey<47>");
	m__zombies2->p_Clear();
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/thread.monkey<48>");
	m__alive->p_Push13(this);
	return this;
}
void c_Thread::mark(){
	BBThread::mark();
}
String c_Thread::debug(){
	String t="(Thread)\n";
	t+=dbg_decl("_alive",&c_Thread::m__alive);
	t+=dbg_decl("_zombies",&c_Thread::m__zombies);
	t+=dbg_decl("_zombies2",&c_Thread::m__zombies2);
	return t;
}
c_AsyncQueue::c_AsyncQueue(){
	m_source=0;
	m_queue=Array<c_AsyncOp* >(256);
	m_put=0;
	m_get=0;
	m_nxt=0;
}
c_AsyncQueue* c_AsyncQueue::m_new(c_Socket* t_source){
	DBG_ENTER("AsyncQueue.new")
	c_AsyncQueue *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_source,"source")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<69>");
	c_Thread::m_new();
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<70>");
	gc_assign(this->m_source,t_source);
	return this;
}
c_AsyncQueue* c_AsyncQueue::m_new2(){
	DBG_ENTER("AsyncQueue.new")
	c_AsyncQueue *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<67>");
	c_Thread::m_new();
	return this;
}
void c_AsyncQueue::p_Enqueue(c_AsyncOp* t_op){
	DBG_ENTER("AsyncQueue.Enqueue")
	c_AsyncQueue *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_op,"op")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<78>");
	gc_assign(m_queue.At(m_put),t_op);
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<79>");
	m_put=(m_put+1) % 256;
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<80>");
	if(m_put==m_get){
		DBG_BLOCK();
		bbError(String(L"AsyncQueue queue overflow!",26));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<81>");
	Start();
}
void c_AsyncQueue::p_UpdateAsyncEvents(){
	DBG_ENTER("AsyncQueue.UpdateAsyncEvents")
	c_AsyncQueue *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<85>");
	if(m_nxt!=m_put){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<86>");
		if(!IsRunning()){
			DBG_BLOCK();
			bbPrint(String(L"RACE!",5));
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<87>");
		Start();
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<89>");
	while(m_get!=m_nxt){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<90>");
		c_AsyncOp* t_op=m_queue.At(m_get);
		DBG_LOCAL(t_op,"op")
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<91>");
		m_get=(m_get+1) % 256;
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<92>");
		t_op->p_Complete(m_source);
	}
}
void c_AsyncQueue::Run__UNSAFE__(){
	while(m_nxt!=m_put){
		m_queue.At(m_nxt)->p_Execute__UNSAFE__(m_source);
		m_nxt=(m_nxt+1) % 256;
	}
}
void c_AsyncQueue::mark(){
	c_Thread::mark();
	gc_mark_q(m_source);
	gc_mark_q(m_queue);
}
String c_AsyncQueue::debug(){
	String t="(AsyncQueue)\n";
	t=c_Thread::debug()+t;
	t+=dbg_decl("source",&m_source);
	t+=dbg_decl("queue",&m_queue);
	t+=dbg_decl("put",&m_put);
	t+=dbg_decl("get",&m_get);
	t+=dbg_decl("nxt",&m_nxt);
	return t;
}
c_Stack5::c_Stack5(){
	m_data=Array<c_Thread* >();
	m_length=0;
}
c_Stack5* c_Stack5::m_new(){
	DBG_ENTER("Stack.new")
	c_Stack5 *self=this;
	DBG_LOCAL(self,"Self")
	return this;
}
c_Stack5* c_Stack5::m_new2(Array<c_Thread* > t_data){
	DBG_ENTER("Stack.new")
	c_Stack5 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<13>");
	gc_assign(this->m_data,t_data.Slice(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<14>");
	this->m_length=t_data.Length();
	return this;
}
c_Enumerator10* c_Stack5::p_ObjectEnumerator(){
	DBG_ENTER("Stack.ObjectEnumerator")
	c_Stack5 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<184>");
	c_Enumerator10* t_=(new c_Enumerator10)->m_new(this);
	return t_;
}
c_Thread* c_Stack5::m_NIL;
void c_Stack5::p_Length(int t_newlength){
	DBG_ENTER("Stack.Length")
	c_Stack5 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_newlength,"newlength")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<41>");
	if(t_newlength<m_length){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<42>");
		for(int t_i=t_newlength;t_i<m_length;t_i=t_i+1){
			DBG_BLOCK();
			DBG_LOCAL(t_i,"i")
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<43>");
			gc_assign(m_data.At(t_i),m_NIL);
		}
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<45>");
		if(t_newlength>m_data.Length()){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<46>");
			gc_assign(m_data,m_data.Resize(bb_math2_Max(m_length*2+10,t_newlength)));
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<48>");
	m_length=t_newlength;
}
int c_Stack5::p_Length2(){
	DBG_ENTER("Stack.Length")
	c_Stack5 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<52>");
	return m_length;
}
void c_Stack5::p_Push13(c_Thread* t_value){
	DBG_ENTER("Stack.Push")
	c_Stack5 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_value,"value")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<67>");
	if(m_length==m_data.Length()){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<68>");
		gc_assign(m_data,m_data.Resize(m_length*2+10));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<70>");
	gc_assign(m_data.At(m_length),t_value);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<71>");
	m_length+=1;
}
void c_Stack5::p_Push14(Array<c_Thread* > t_values,int t_offset,int t_count){
	DBG_ENTER("Stack.Push")
	c_Stack5 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_values,"values")
	DBG_LOCAL(t_offset,"offset")
	DBG_LOCAL(t_count,"count")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<79>");
	for(int t_i=0;t_i<t_count;t_i=t_i+1){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<80>");
		p_Push13(t_values.At(t_offset+t_i));
	}
}
void c_Stack5::p_Push15(Array<c_Thread* > t_values,int t_offset){
	DBG_ENTER("Stack.Push")
	c_Stack5 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_values,"values")
	DBG_LOCAL(t_offset,"offset")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<75>");
	p_Push14(t_values,t_offset,t_values.Length()-t_offset);
}
void c_Stack5::p_Clear(){
	DBG_ENTER("Stack.Clear")
	c_Stack5 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<34>");
	for(int t_i=0;t_i<m_length;t_i=t_i+1){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<35>");
		gc_assign(m_data.At(t_i),m_NIL);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<37>");
	m_length=0;
}
void c_Stack5::mark(){
	Object::mark();
	gc_mark_q(m_data);
}
String c_Stack5::debug(){
	String t="(Stack)\n";
	t+=dbg_decl("NIL",&c_Stack5::m_NIL);
	t+=dbg_decl("data",&m_data);
	t+=dbg_decl("length",&m_length);
	return t;
}
c_Enumerator10::c_Enumerator10(){
	m_stack=0;
	m_index=0;
}
c_Enumerator10* c_Enumerator10::m_new(c_Stack5* t_stack){
	DBG_ENTER("Enumerator.new")
	c_Enumerator10 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_stack,"stack")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<255>");
	gc_assign(this->m_stack,t_stack);
	return this;
}
c_Enumerator10* c_Enumerator10::m_new2(){
	DBG_ENTER("Enumerator.new")
	c_Enumerator10 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<252>");
	return this;
}
bool c_Enumerator10::p_HasNext(){
	DBG_ENTER("Enumerator.HasNext")
	c_Enumerator10 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<259>");
	bool t_=m_index<m_stack->p_Length2();
	return t_;
}
c_Thread* c_Enumerator10::p_NextObject(){
	DBG_ENTER("Enumerator.NextObject")
	c_Enumerator10 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<263>");
	m_index+=1;
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<264>");
	c_Thread* t_=m_stack->m_data.At(m_index-1);
	return t_;
}
void c_Enumerator10::mark(){
	Object::mark();
	gc_mark_q(m_stack);
}
String c_Enumerator10::debug(){
	String t="(Enumerator)\n";
	t+=dbg_decl("stack",&m_stack);
	t+=dbg_decl("index",&m_index);
	return t;
}
c_Stack6::c_Stack6(){
	m_data=Array<c_IAsyncEventSource* >();
	m_length=0;
}
c_Stack6* c_Stack6::m_new(){
	DBG_ENTER("Stack.new")
	c_Stack6 *self=this;
	DBG_LOCAL(self,"Self")
	return this;
}
c_Stack6* c_Stack6::m_new2(Array<c_IAsyncEventSource* > t_data){
	DBG_ENTER("Stack.new")
	c_Stack6 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<13>");
	gc_assign(this->m_data,t_data.Slice(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<14>");
	this->m_length=t_data.Length();
	return this;
}
bool c_Stack6::p_Equals3(c_IAsyncEventSource* t_lhs,c_IAsyncEventSource* t_rhs){
	DBG_ENTER("Stack.Equals")
	c_Stack6 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_lhs,"lhs")
	DBG_LOCAL(t_rhs,"rhs")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<26>");
	bool t_=t_lhs==t_rhs;
	return t_;
}
bool c_Stack6::p_Contains2(c_IAsyncEventSource* t_value){
	DBG_ENTER("Stack.Contains")
	c_Stack6 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_value,"value")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<60>");
	for(int t_i=0;t_i<m_length;t_i=t_i+1){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<61>");
		if(p_Equals3(m_data.At(t_i),t_value)){
			DBG_BLOCK();
			return true;
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<63>");
	return false;
}
void c_Stack6::p_Push16(c_IAsyncEventSource* t_value){
	DBG_ENTER("Stack.Push")
	c_Stack6 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_value,"value")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<67>");
	if(m_length==m_data.Length()){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<68>");
		gc_assign(m_data,m_data.Resize(m_length*2+10));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<70>");
	gc_assign(m_data.At(m_length),t_value);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<71>");
	m_length+=1;
}
void c_Stack6::p_Push17(Array<c_IAsyncEventSource* > t_values,int t_offset,int t_count){
	DBG_ENTER("Stack.Push")
	c_Stack6 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_values,"values")
	DBG_LOCAL(t_offset,"offset")
	DBG_LOCAL(t_count,"count")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<79>");
	for(int t_i=0;t_i<t_count;t_i=t_i+1){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<80>");
		p_Push16(t_values.At(t_offset+t_i));
	}
}
void c_Stack6::p_Push18(Array<c_IAsyncEventSource* > t_values,int t_offset){
	DBG_ENTER("Stack.Push")
	c_Stack6 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_values,"values")
	DBG_LOCAL(t_offset,"offset")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<75>");
	p_Push17(t_values,t_offset,t_values.Length()-t_offset);
}
c_IAsyncEventSource* c_Stack6::m_NIL;
void c_Stack6::p_Length(int t_newlength){
	DBG_ENTER("Stack.Length")
	c_Stack6 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_newlength,"newlength")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<41>");
	if(t_newlength<m_length){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<42>");
		for(int t_i=t_newlength;t_i<m_length;t_i=t_i+1){
			DBG_BLOCK();
			DBG_LOCAL(t_i,"i")
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<43>");
			gc_assign(m_data.At(t_i),m_NIL);
		}
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<45>");
		if(t_newlength>m_data.Length()){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<46>");
			gc_assign(m_data,m_data.Resize(bb_math2_Max(m_length*2+10,t_newlength)));
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<48>");
	m_length=t_newlength;
}
int c_Stack6::p_Length2(){
	DBG_ENTER("Stack.Length")
	c_Stack6 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<52>");
	return m_length;
}
c_IAsyncEventSource* c_Stack6::p_Get(int t_index){
	DBG_ENTER("Stack.Get")
	c_Stack6 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_index,"index")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/stack.monkey<100>");
	return m_data.At(t_index);
}
void c_Stack6::mark(){
	Object::mark();
	gc_mark_q(m_data);
}
String c_Stack6::debug(){
	String t="(Stack)\n";
	t+=dbg_decl("NIL",&c_Stack6::m_NIL);
	t+=dbg_decl("data",&m_data);
	t+=dbg_decl("length",&m_length);
	return t;
}
c_Stack6* bb_asyncevent__sources;
void bb_asyncevent_AddAsyncEventSource(c_IAsyncEventSource* t_source){
	DBG_ENTER("AddAsyncEventSource")
	DBG_LOCAL(t_source,"source")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/asyncevent.monkey<14>");
	if(bb_asyncevent__sources->p_Contains2(t_source)){
		DBG_BLOCK();
		bbError(String(L"Async event source is already active",36));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/asyncevent.monkey<15>");
	bb_asyncevent__sources->p_Push16(t_source);
}
c_AsyncOp::c_AsyncOp(){
}
c_AsyncOp* c_AsyncOp::m_new(){
	DBG_ENTER("AsyncOp.new")
	c_AsyncOp *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<57>");
	return this;
}
void c_AsyncOp::mark(){
	Object::mark();
}
String c_AsyncOp::debug(){
	String t="(AsyncOp)\n";
	return t;
}
c_AsyncConnectOp::c_AsyncConnectOp(){
	m__socket=0;
	m__host=String();
	m__port=0;
	m__onComplete=0;
	m__result=false;
}
c_AsyncConnectOp* c_AsyncConnectOp::m_new(BBSocket* t_socket,String t_host,int t_port,c_IOnConnectComplete* t_onComplete){
	DBG_ENTER("AsyncConnectOp.new")
	c_AsyncConnectOp *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_socket,"socket")
	DBG_LOCAL(t_host,"host")
	DBG_LOCAL(t_port,"port")
	DBG_LOCAL(t_onComplete,"onComplete")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<120>");
	c_AsyncOp::m_new();
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<121>");
	gc_assign(m__socket,t_socket);
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<122>");
	m__host=t_host;
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<123>");
	m__port=t_port;
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<124>");
	gc_assign(m__onComplete,t_onComplete);
	return this;
}
c_AsyncConnectOp* c_AsyncConnectOp::m_new2(){
	DBG_ENTER("AsyncConnectOp.new")
	c_AsyncConnectOp *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<118>");
	c_AsyncOp::m_new();
	return this;
}
void c_AsyncConnectOp::p_Execute__UNSAFE__(c_Socket* t_source){
	m__result=m__socket->Connect(m__host,m__port);
}
void c_AsyncConnectOp::p_Complete(c_Socket* t_source){
	DBG_ENTER("AsyncConnectOp.Complete")
	c_AsyncConnectOp *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_source,"source")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<140>");
	if(m__result){
		DBG_BLOCK();
		t_source->p_OnConnectComplete2();
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<141>");
	m__onComplete->p_OnConnectComplete(m__result,t_source);
}
void c_AsyncConnectOp::mark(){
	c_AsyncOp::mark();
	gc_mark_q(m__socket);
	gc_mark_q(m__onComplete);
}
String c_AsyncConnectOp::debug(){
	String t="(AsyncConnectOp)\n";
	t=c_AsyncOp::debug()+t;
	t+=dbg_decl("_socket",&m__socket);
	t+=dbg_decl("_host",&m__host);
	t+=dbg_decl("_port",&m__port);
	t+=dbg_decl("_onComplete",&m__onComplete);
	t+=dbg_decl("_result",&m__result);
	return t;
}
c_SKNCalMeshLoader::c_SKNCalMeshLoader(){
}
c_SKNCalMeshLoader* c_SKNCalMeshLoader::m_new(){
	DBG_ENTER("SKNCalMeshLoader.new")
	c_SKNCalMeshLoader *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<152>");
	c_CalLoader::m_new();
	return this;
}
Object* c_SKNCalMeshLoader::p_Load2(String t_data){
	DBG_ENTER("SKNCalMeshLoader.Load")
	c_SKNCalMeshLoader *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<155>");
	bool t_isimvu=false;
	DBG_LOCAL(t_isimvu,"isimvu")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<156>");
	c_XMLError* t_error=(new c_XMLError)->m_new();
	DBG_LOCAL(t_error,"error")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<157>");
	c_XMLDoc* t_doc=bb_xml_ParseXML(t_data,t_error,1);
	DBG_LOCAL(t_doc,"doc")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<158>");
	if(t_doc==0 && t_error->m_error){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<159>");
		bbPrint(t_error->p_ToString());
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<160>");
		m_loaded=true;
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<161>");
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<164>");
	c_XMLNode* t_meshElem=(t_doc);
	DBG_LOCAL(t_meshElem,"meshElem")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<166>");
	if(t_meshElem==0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<167>");
		bbPrint(String(L"Mesh Node not found!",20));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<168>");
		m_loaded=true;
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<169>");
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<172>");
	if(t_meshElem->m_name!=String(L"mesh",4)){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<173>");
		if(t_meshElem->m_name==String(L"header",6)){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<174>");
			t_meshElem=t_meshElem->p_GetChild(false);
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<175>");
			t_isimvu=true;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<176>");
			if(t_meshElem->m_name!=String(L"mesh",4)){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<177>");
				bbPrint(String(L"Wrong Start Node: ",18)+t_meshElem->m_name);
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<178>");
				m_loaded=true;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<179>");
				return 0;
			}
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<182>");
			bbPrint(String(L"Wrong Start Node: ",18)+t_meshElem->m_name);
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<183>");
			m_loaded=true;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<184>");
			return 0;
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<188>");
	if(t_meshElem->p_GetXMLAttribute(String(L"version",7))->m_value!=String(L"1000",4) && t_isimvu==false){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<189>");
		bbPrint(String(L"Wrong Version: ",15)+t_meshElem->p_GetXMLAttribute(String(L"version",7))->m_value);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<190>");
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<193>");
	int t_submeshCount=(t_meshElem->p_GetXMLAttribute(String(L"numsubmesh",10))->m_value).ToInt();
	DBG_LOCAL(t_submeshCount,"submeshCount")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<194>");
	c_CalCoreMesh* t_coreMesh=(new c_CalCoreMesh)->m_new();
	DBG_LOCAL(t_coreMesh,"coreMesh")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<196>");
	c_List13* t_submeshIds=t_meshElem->p_GetChildren2(String(L"submesh",7),0,false);
	DBG_LOCAL(t_submeshIds,"submeshIds")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<198>");
	c_Enumerator15* t_=t_submeshIds->p_ObjectEnumerator();
	while(t_->p_HasNext()){
		DBG_BLOCK();
		c_XMLNode* t_submeshElem=t_->p_NextObject();
		DBG_LOCAL(t_submeshElem,"submeshElem")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<200>");
		int t_coreMaterialThreadId=(t_submeshElem->p_GetXMLAttribute(String(L"material",8))->m_value).ToInt();
		DBG_LOCAL(t_coreMaterialThreadId,"coreMaterialThreadId")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<201>");
		int t_vertexCount=(t_submeshElem->p_GetXMLAttribute(String(L"numvertices",11))->m_value).ToInt();
		DBG_LOCAL(t_vertexCount,"vertexCount")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<202>");
		int t_faceCount=(t_submeshElem->p_GetXMLAttribute(String(L"numfaces",8))->m_value).ToInt();
		DBG_LOCAL(t_faceCount,"faceCount")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<203>");
		int t_lodCount=(t_submeshElem->p_GetXMLAttribute(String(L"numlodsteps",11))->m_value).ToInt();
		DBG_LOCAL(t_lodCount,"lodCount")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<204>");
		int t_springCount=(t_submeshElem->p_GetXMLAttribute(String(L"numsprings",10))->m_value).ToInt();
		DBG_LOCAL(t_springCount,"springCount")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<205>");
		int t_textureCoordinateCount=(t_submeshElem->p_GetXMLAttribute(String(L"numtexcoords",12))->m_value).ToInt();
		DBG_LOCAL(t_textureCoordinateCount,"textureCoordinateCount")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<207>");
		c_CalCoreSubmesh* t_coreSubmesh=(new c_CalCoreSubmesh)->m_new();
		DBG_LOCAL(t_coreSubmesh,"coreSubmesh")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<208>");
		t_coreSubmesh->p_setLodCount(t_lodCount);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<209>");
		t_coreSubmesh->p_setCoreMaterialThreadId(t_coreMaterialThreadId);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<211>");
		if(t_coreSubmesh->p_reserve(t_vertexCount,t_textureCoordinateCount,t_faceCount,t_springCount)==false){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<212>");
			bbPrint(String(L"Could not reserve arrays",24));
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<213>");
			return 0;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<216>");
		c_List13* t_vertIds=t_submeshElem->p_GetChildren2(String(L"vertex",6),0,false);
		DBG_LOCAL(t_vertIds,"vertIds")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<217>");
		int t_vertexId=0;
		DBG_LOCAL(t_vertexId,"vertexId")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<218>");
		c_Enumerator15* t_2=t_vertIds->p_ObjectEnumerator();
		while(t_2->p_HasNext()){
			DBG_BLOCK();
			c_XMLNode* t_vertexElem=t_2->p_NextObject();
			DBG_LOCAL(t_vertexElem,"vertexElem")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<220>");
			c_CalVertex* t_vertex=(new c_CalVertex)->m_new();
			DBG_LOCAL(t_vertex,"vertex")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<222>");
			c_XMLNode* t_posElem=t_vertexElem->p_GetChild2(String(L"pos",3),false);
			DBG_LOCAL(t_posElem,"posElem")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<223>");
			Array<String > t_p=t_posElem->m_value.Split(String(L" ",1));
			DBG_LOCAL(t_p,"p")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<225>");
			t_vertex->m_position->m_x=(t_p.At(0)).ToFloat();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<226>");
			t_vertex->m_position->m_y=(t_p.At(1)).ToFloat();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<227>");
			t_vertex->m_position->m_z=(t_p.At(2)).ToFloat();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<229>");
			c_XMLNode* t_normElem=t_vertexElem->p_GetChild2(String(L"norm",4),false);
			DBG_LOCAL(t_normElem,"normElem")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<230>");
			Array<String > t_n=t_normElem->m_value.Split(String(L" ",1));
			DBG_LOCAL(t_n,"n")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<232>");
			t_vertex->m_normal->m_x=(t_n.At(0)).ToFloat();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<233>");
			t_vertex->m_normal->m_y=(t_n.At(1)).ToFloat();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<234>");
			t_vertex->m_normal->m_z=(t_n.At(2)).ToFloat();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<237>");
			int t_textureCoordinateId=0;
			DBG_LOCAL(t_textureCoordinateId,"textureCoordinateId")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<238>");
			c_List13* t_textcoordsIds=t_vertexElem->p_GetChildren2(String(L"texcoord",8),0,false);
			DBG_LOCAL(t_textcoordsIds,"textcoordsIds")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<239>");
			c_Enumerator15* t_3=t_textcoordsIds->p_ObjectEnumerator();
			while(t_3->p_HasNext()){
				DBG_BLOCK();
				c_XMLNode* t_texcoordElem=t_3->p_NextObject();
				DBG_LOCAL(t_texcoordElem,"texcoordElem")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<241>");
				c_CalTextureCoordinate* t_textureCoordinate=(new c_CalTextureCoordinate)->m_new();
				DBG_LOCAL(t_textureCoordinate,"textureCoordinate")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<242>");
				Array<String > t_tc=t_texcoordElem->m_value.Split(String(L" ",1));
				DBG_LOCAL(t_tc,"tc")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<244>");
				t_textureCoordinate->m_u=(t_tc.At(0)).ToFloat();
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<245>");
				t_textureCoordinate->m_v=(t_tc.At(1)).ToFloat();
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<247>");
				t_coreSubmesh->p_setTextureCoordinate(t_vertexId,t_textureCoordinateId,t_textureCoordinate);
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<248>");
				t_textureCoordinateId=t_textureCoordinateId+1;
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<251>");
			c_List13* t_influenceIds=t_vertexElem->p_GetChildren2(String(L"influence",9),0,false);
			DBG_LOCAL(t_influenceIds,"influenceIds")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<252>");
			int t_influenceId=0;
			DBG_LOCAL(t_influenceId,"influenceId")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<253>");
			c_Enumerator15* t_4=t_influenceIds->p_ObjectEnumerator();
			while(t_4->p_HasNext()){
				DBG_BLOCK();
				c_XMLNode* t_influenceElem=t_4->p_NextObject();
				DBG_LOCAL(t_influenceElem,"influenceElem")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<255>");
				c_CalInfluence* t_influence=(new c_CalInfluence)->m_new();
				DBG_LOCAL(t_influence,"influence")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<256>");
				t_influence->m_boneId=(t_influenceElem->p_GetXMLAttribute(String(L"id",2))->m_value).ToInt();
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<257>");
				t_influence->m_weight=(t_influenceElem->m_value).ToFloat();
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<258>");
				gc_assign(t_vertex->m_vectorInfluence,t_vertex->m_vectorInfluence.Resize(t_vertex->m_vectorInfluence.Length()+1));
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<259>");
				gc_assign(t_vertex->m_vectorInfluence.At(t_vertex->m_vectorInfluence.Length()-1),t_influence);
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<260>");
				t_influenceId=t_influenceId+1;
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<263>");
			t_coreSubmesh->p_setVertex(t_vertexId,t_vertex);
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<267>");
			t_vertexId=t_vertexId+1;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<269>");
		int t_faceId=0;
		DBG_LOCAL(t_faceId,"faceId")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<270>");
		c_List13* t_faceIds=t_submeshElem->p_GetChildren2(String(L"face",4),0,false);
		DBG_LOCAL(t_faceIds,"faceIds")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<271>");
		c_Enumerator15* t_5=t_faceIds->p_ObjectEnumerator();
		while(t_5->p_HasNext()){
			DBG_BLOCK();
			c_XMLNode* t_faceElem=t_5->p_NextObject();
			DBG_LOCAL(t_faceElem,"faceElem")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<273>");
			c_CalFace* t_face=(new c_CalFace)->m_new();
			DBG_LOCAL(t_face,"face")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<274>");
			Array<String > t_fi=t_faceElem->p_GetXMLAttribute(String(L"vertexid",8))->m_value.Split(String(L" ",1));
			DBG_LOCAL(t_fi,"fi")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<275>");
			t_face->m_vertexId.At(0)=(t_fi.At(0)).ToInt();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<276>");
			t_face->m_vertexId.At(1)=(t_fi.At(1)).ToInt();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<277>");
			t_face->m_vertexId.At(2)=(t_fi.At(2)).ToInt();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<279>");
			t_coreSubmesh->p_setFace(t_faceId,t_face);
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<280>");
			t_faceId=t_faceId+1;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<282>");
		t_coreMesh->p_addCoreSubmesh(t_coreSubmesh);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<285>");
	gc_assign(m_loadedobject,(t_coreMesh));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<286>");
	m_loaded=true;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<287>");
	return m_loadedobject;
}
void c_SKNCalMeshLoader::mark(){
	c_CalLoader::mark();
}
String c_SKNCalMeshLoader::debug(){
	String t="(SKNCalMeshLoader)\n";
	t=c_CalLoader::debug()+t;
	return t;
}
c_SKNCalAnimationLoader::c_SKNCalAnimationLoader(){
}
c_SKNCalAnimationLoader* c_SKNCalAnimationLoader::m_new(){
	DBG_ENTER("SKNCalAnimationLoader.new")
	c_SKNCalAnimationLoader *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<43>");
	c_CalLoader::m_new();
	return this;
}
Object* c_SKNCalAnimationLoader::p_Load2(String t_data){
	DBG_ENTER("SKNCalAnimationLoader.Load")
	c_SKNCalAnimationLoader *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<47>");
	bool t_isimvu=false;
	DBG_LOCAL(t_isimvu,"isimvu")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<49>");
	c_XMLError* t_error=(new c_XMLError)->m_new();
	DBG_LOCAL(t_error,"error")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<50>");
	c_XMLDoc* t_doc=bb_xml_ParseXML(t_data,t_error,1);
	DBG_LOCAL(t_doc,"doc")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<51>");
	if(t_doc==0 && t_error->m_error){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<52>");
		bbPrint(t_error->p_ToString());
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<53>");
		m_loaded=true;
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<54>");
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<57>");
	c_XMLNode* t_animationElem=(t_doc);
	DBG_LOCAL(t_animationElem,"animationElem")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<59>");
	if(t_animationElem==0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<60>");
		bbPrint(String(L"Animation Node not found!",25));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<61>");
		m_loaded=true;
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<62>");
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<65>");
	if(t_animationElem->m_name!=String(L"animation",9)){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<66>");
		if(t_animationElem->m_name==String(L"header",6)){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<67>");
			t_animationElem=t_animationElem->p_GetChild(false);
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<68>");
			t_isimvu=true;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<69>");
			if(t_animationElem->m_name!=String(L"animation",9)){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<70>");
				bbPrint(String(L"Wrong Start Node: ",18)+t_animationElem->m_name);
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<71>");
				m_loaded=true;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<72>");
				return 0;
			}
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<75>");
			bbPrint(String(L"Wrong Start Node: ",18)+t_animationElem->m_name);
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<76>");
			m_loaded=true;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<77>");
			return 0;
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<82>");
	if(t_animationElem->p_GetXMLAttribute(String(L"version",7))->m_value!=String(L"1000",4) && t_isimvu==false){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<83>");
		bbPrint(String(L"Wrong Version: ",15)+t_animationElem->p_GetXMLAttribute(String(L"version",7))->m_value);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<84>");
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<87>");
	Float t_duration=(t_animationElem->p_GetXMLAttribute(String(L"duration",8))->m_value).ToFloat();
	DBG_LOCAL(t_duration,"duration")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<88>");
	int t_trackCount=(t_animationElem->p_GetXMLAttribute(String(L"numtracks",9))->m_value).ToInt();
	DBG_LOCAL(t_trackCount,"trackCount")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<90>");
	c_CalCoreAnimation* t_coreAnimation=(new c_CalCoreAnimation)->m_new();
	DBG_LOCAL(t_coreAnimation,"coreAnimation")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<92>");
	if(t_duration<=FLOAT(0.0)){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<93>");
		bbPrint(String(L"Invalid Duration",16));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<94>");
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<97>");
	t_coreAnimation->p_setDuration(t_duration);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<98>");
	c_List13* t_trackIds=t_animationElem->p_GetChildren2(String(L"track",5),0,false);
	DBG_LOCAL(t_trackIds,"trackIds")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<100>");
	c_Enumerator15* t_=t_trackIds->p_ObjectEnumerator();
	while(t_->p_HasNext()){
		DBG_BLOCK();
		c_XMLNode* t_trackElem=t_->p_NextObject();
		DBG_LOCAL(t_trackElem,"trackElem")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<102>");
		c_CalCoreTrack* t_coreTrack=(new c_CalCoreTrack)->m_new();
		DBG_LOCAL(t_coreTrack,"coreTrack")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<104>");
		int t_coreBoneId=(t_trackElem->p_GetXMLAttribute(String(L"boneid",6))->m_value).ToInt();
		DBG_LOCAL(t_coreBoneId,"coreBoneId")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<105>");
		t_coreTrack->p_setCoreBoneId(t_coreBoneId);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<107>");
		int t_keyframeCount=(t_trackElem->p_GetXMLAttribute(String(L"numkeyframes",12))->m_value).ToInt();
		DBG_LOCAL(t_keyframeCount,"keyframeCount")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<109>");
		c_List13* t_keyIds=t_trackElem->p_GetChildren2(String(L"keyframe",8),0,false);
		DBG_LOCAL(t_keyIds,"keyIds")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<111>");
		c_Enumerator15* t_2=t_keyIds->p_ObjectEnumerator();
		while(t_2->p_HasNext()){
			DBG_BLOCK();
			c_XMLNode* t_keyframeElem=t_2->p_NextObject();
			DBG_LOCAL(t_keyframeElem,"keyframeElem")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<113>");
			Float t_time=(t_keyframeElem->p_GetXMLAttribute(String(L"time",4))->m_value).ToFloat();
			DBG_LOCAL(t_time,"time")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<115>");
			c_XMLNode* t_translationElem=t_keyframeElem->p_GetChild2(String(L"translation",11),false);
			DBG_LOCAL(t_translationElem,"translationElem")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<116>");
			Array<String > t_tr=t_translationElem->m_value.Split(String(L" ",1));
			DBG_LOCAL(t_tr,"tr")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<117>");
			Float t_tx=FLOAT(.0);
			Float t_ty=FLOAT(.0);
			Float t_tz=FLOAT(.0);
			DBG_LOCAL(t_tx,"tx")
			DBG_LOCAL(t_ty,"ty")
			DBG_LOCAL(t_tz,"tz")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<119>");
			t_tx=(t_tr.At(0)).ToFloat();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<120>");
			t_ty=(t_tr.At(1)).ToFloat();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<121>");
			t_tz=(t_tr.At(2)).ToFloat();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<123>");
			c_XMLNode* t_rotationElem=t_keyframeElem->p_GetChild2(String(L"rotation",8),false);
			DBG_LOCAL(t_rotationElem,"rotationElem")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<124>");
			Array<String > t_ro=t_rotationElem->m_value.Split(String(L" ",1));
			DBG_LOCAL(t_ro,"ro")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<125>");
			Float t_rx=FLOAT(.0);
			Float t_ry=FLOAT(.0);
			Float t_rz=FLOAT(.0);
			Float t_rw=FLOAT(.0);
			DBG_LOCAL(t_rx,"rx")
			DBG_LOCAL(t_ry,"ry")
			DBG_LOCAL(t_rz,"rz")
			DBG_LOCAL(t_rw,"rw")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<127>");
			t_rx=(t_ro.At(0)).ToFloat();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<128>");
			t_ry=(t_ro.At(1)).ToFloat();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<129>");
			t_rz=(t_ro.At(2)).ToFloat();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<130>");
			t_rw=(t_ro.At(3)).ToFloat();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<132>");
			c_CalCoreKeyframe* t_coreKeyframe=(new c_CalCoreKeyframe)->m_new();
			DBG_LOCAL(t_coreKeyframe,"coreKeyframe")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<133>");
			t_coreKeyframe->p_setTime(t_time);
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<134>");
			t_coreKeyframe->p_setTranslation((new c_CalVector)->m_new3(t_tx,t_ty,t_tz));
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<135>");
			t_coreKeyframe->p_setRotation((new c_CalQuaternion)->m_new3(t_rx,t_ry,t_rz,t_rw));
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<136>");
			t_coreTrack->p_addCoreKeyframe(t_coreKeyframe);
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<139>");
		t_coreAnimation->p_addCoreTrack(t_coreTrack);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<141>");
	gc_assign(m_loadedobject,(t_coreAnimation));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<142>");
	m_loaded=true;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<143>");
	return m_loadedobject;
}
void c_SKNCalAnimationLoader::mark(){
	c_CalLoader::mark();
}
String c_SKNCalAnimationLoader::debug(){
	String t="(SKNCalAnimationLoader)\n";
	t=c_CalLoader::debug()+t;
	return t;
}
c_SKNCalImageLoader::c_SKNCalImageLoader(){
}
c_SKNCalImageLoader* c_SKNCalImageLoader::m_new(){
	DBG_ENTER("SKNCalImageLoader.new")
	c_SKNCalImageLoader *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<4>");
	c_CalLoader::m_new();
	return this;
}
Object* c_SKNCalImageLoader::p_Load2(String t_data){
	DBG_ENTER("SKNCalImageLoader.Load")
	c_SKNCalImageLoader *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<8>");
	bool t_isimvu=false;
	DBG_LOCAL(t_isimvu,"isimvu")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<10>");
	c_XMLError* t_error=(new c_XMLError)->m_new();
	DBG_LOCAL(t_error,"error")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<11>");
	c_XMLDoc* t_doc=bb_xml_ParseXML(t_data,t_error,1);
	DBG_LOCAL(t_doc,"doc")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<12>");
	if(t_doc==0 && t_error->m_error){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<13>");
		bbPrint(t_error->p_ToString());
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<14>");
		m_loaded=true;
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<15>");
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<18>");
	c_XMLNode* t_imageElem=(t_doc);
	DBG_LOCAL(t_imageElem,"imageElem")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<20>");
	if(t_imageElem==0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<21>");
		bbPrint(String(L"Image Node not found!",21));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<22>");
		m_loaded=true;
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<23>");
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<25>");
	if(t_imageElem->m_name!=String(L"image",5)){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<26>");
		bbPrint(String(L"Wrong Start Node: ",18)+t_imageElem->m_name);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<27>");
		m_loaded=true;
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<28>");
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<30>");
	c_CalImage* t_cimg=(new c_CalImage)->m_new2((t_imageElem->p_GetXMLAttribute(String(L"width",5))->m_value).ToInt(),(t_imageElem->p_GetXMLAttribute(String(L"height",6))->m_value).ToInt(),t_imageElem->m_value.Split(String(L"|",1)));
	DBG_LOCAL(t_cimg,"cimg")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<33>");
	gc_assign(m_loadedobject,(t_cimg));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<34>");
	m_loaded=true;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/sknxmlloader.monkey<35>");
	return m_loadedobject;
}
void c_SKNCalImageLoader::mark(){
	c_CalLoader::mark();
}
String c_SKNCalImageLoader::debug(){
	String t="(SKNCalImageLoader)\n";
	t=c_CalLoader::debug()+t;
	return t;
}
c_Cal3dB3d::c_Cal3dB3d(){
	m_B3dModel=0;
	m_Meshes=0;
	m_Anims=0;
	m_CoreModel=0;
	m_isloaded=false;
	m_Skele=0;
	m_CModel=0;
	m_cal_renderer=0;
}
c_Cal3dB3d* c_Cal3dB3d::m_new(){
	DBG_ENTER("Cal3dB3d.new")
	c_Cal3dB3d *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<78>");
	gc_assign(m_B3dModel,c_TMesh::m_CreateMesh(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<79>");
	gc_assign(m_Meshes,(new c_List9)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<80>");
	gc_assign(m_Anims,(new c_List10)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<82>");
	gc_assign(m_CoreModel,(new c_CalCoreModel)->m_new(String(L"Model",5)));
	return this;
}
int c_Cal3dB3d::p_SetSkeleton(c_CalCoreSkeleton* t_skel){
	DBG_ENTER("Cal3dB3d.SetSkeleton")
	c_Cal3dB3d *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_skel,"skel")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<87>");
	gc_assign(m_Skele,t_skel);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<88>");
	m_CoreModel->p_setCoreSkeleton(m_Skele);
	return 0;
}
int c_Cal3dB3d::p_AddMesh(c_CalCoreMesh* t_msh){
	DBG_ENTER("Cal3dB3d.AddMesh")
	c_Cal3dB3d *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_msh,"msh")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<109>");
	if(t_msh!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<111>");
		c_Cal3dB3dMesh* t_c3db3dm=(new c_Cal3dB3dMesh)->m_new();
		DBG_LOCAL(t_c3db3dm,"c3db3dm")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<112>");
		t_c3db3dm->m_MID=m_CoreModel->p_addCoreMesh(t_msh);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<113>");
		bbPrint(String(L"Added: ",7)+String(t_c3db3dm->m_MID));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<114>");
		gc_assign(t_c3db3dm->m_CMesh,t_msh);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<115>");
		gc_assign(t_c3db3dm->m_B3dMesh,c_TMesh::m_CreateMesh(m_B3dModel));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<116>");
		t_c3db3dm->m_B3dMesh->m_anim=2;
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<117>");
		m_Meshes->p_AddLast9(t_c3db3dm);
	}
	return 0;
}
int c_Cal3dB3d::p_AddAnim(c_CalCoreAnimation* t_anm){
	DBG_ENTER("Cal3dB3d.AddAnim")
	c_Cal3dB3d *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_anm,"anm")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<94>");
	if(m_Skele==0){
		DBG_BLOCK();
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<97>");
	if(t_anm!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<99>");
		int t_aa=m_CoreModel->p_addCoreAnimation(t_anm);
		DBG_LOCAL(t_aa,"aa")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<100>");
		bbPrint(String(L"Loaded Anim: ",13)+String(t_aa));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<101>");
		m_Anims->p_AddLast10(t_anm);
	}
	return 0;
}
int c_Cal3dB3d::p_Build(){
	DBG_ENTER("Cal3dB3d.Build")
	c_Cal3dB3d *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<124>");
	if(m_CoreModel->p_getCoreSkeleton()==0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<125>");
		bbPrint(String(L"Core Skeleton is null!",22));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<127>");
	m_CoreModel->p_getCoreSkeleton()->p_calculateBoundingBoxes(m_CoreModel);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<128>");
	gc_assign(m_CModel,m_CoreModel->p_makemodel());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<130>");
	c_Enumerator14* t_=m_Meshes->p_ObjectEnumerator();
	while(t_->p_HasNext()){
		DBG_BLOCK();
		c_Cal3dB3dMesh* t_cb3d=t_->p_NextObject();
		DBG_LOCAL(t_cb3d,"cb3d")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<131>");
		m_CModel->p_attachMesh(t_cb3d->m_MID);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<136>");
	if(m_CModel!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<137>");
		bbPrint(String(L"Have Cmodel",11));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<140>");
	gc_assign(m_cal_renderer,m_CModel->p_getRenderer());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<141>");
	m_cal_renderer->p_beginRendering();
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<143>");
	int t_mc=m_cal_renderer->p_getMeshCount();
	DBG_LOCAL(t_mc,"mc")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<144>");
	bbPrint(String(L"Mesh Count: ",12)+String(t_mc));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<145>");
	for(int t_i=0;t_i<=t_mc;t_i=t_i+1){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<147>");
		c_Enumerator14* t_2=m_Meshes->p_ObjectEnumerator();
		while(t_2->p_HasNext()){
			DBG_BLOCK();
			c_Cal3dB3dMesh* t_cb3d2=t_2->p_NextObject();
			DBG_LOCAL(t_cb3d2,"cb3d")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<149>");
			if(t_cb3d2->m_MID==t_i){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<150>");
				bbPrint(String(L"Got Mesh: ",10)+String(t_i));
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<152>");
				int t_submeshCount=m_cal_renderer->p_getSubmeshCount(t_i);
				DBG_LOCAL(t_submeshCount,"submeshCount")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<153>");
				bbPrint(String(L"NOF: Submeshes ",15)+String(t_submeshCount));
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<154>");
				for(int t_ii=0;t_ii<=t_submeshCount-1;t_ii=t_ii+1){
					DBG_BLOCK();
					DBG_LOCAL(t_ii,"ii")
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<156>");
					m_cal_renderer->p_selectMeshSubmesh(t_cb3d2->m_MID,t_ii);
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<158>");
					int t_vertexCount=m_cal_renderer->p_getVertexCount();
					DBG_LOCAL(t_vertexCount,"vertexCount")
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<159>");
					int t_faceCount=m_cal_renderer->p_getFaceCount();
					DBG_LOCAL(t_faceCount,"faceCount")
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<161>");
					bbPrint(String(L"Verts: ",7)+String(t_vertexCount)+String(L" Faces",6)+String(t_faceCount));
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<165>");
					Array<int > t_faces=Array<int >(t_faceCount*3);
					DBG_LOCAL(t_faces,"faces")
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<166>");
					Array<Float > t_vertices=Array<Float >(t_vertexCount*3);
					DBG_LOCAL(t_vertices,"vertices")
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<167>");
					m_cal_renderer->p_getVertices(t_vertices,3);
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<168>");
					m_cal_renderer->p_getFaces(t_faces);
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<169>");
					t_cb3d2->p_Build2(t_vertices,t_faces);
				}
			}
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<186>");
	m_cal_renderer->p_endRendering();
	return 0;
}
int c_Cal3dB3d::p_Update3(Float t_d){
	DBG_ENTER("Cal3dB3d.Update")
	c_Cal3dB3d *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_d,"d")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<194>");
	m_CModel->p_update(t_d);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<195>");
	m_cal_renderer->p_beginRendering();
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<196>");
	int t_mc=m_cal_renderer->p_getMeshCount();
	DBG_LOCAL(t_mc,"mc")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<197>");
	for(int t_i=0;t_i<=t_mc;t_i=t_i+1){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<198>");
		c_Enumerator14* t_=m_Meshes->p_ObjectEnumerator();
		while(t_->p_HasNext()){
			DBG_BLOCK();
			c_Cal3dB3dMesh* t_cb3d=t_->p_NextObject();
			DBG_LOCAL(t_cb3d,"cb3d")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<199>");
			if(t_cb3d->m_MID==t_i){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<200>");
				int t_submeshCount=m_cal_renderer->p_getSubmeshCount(t_i);
				DBG_LOCAL(t_submeshCount,"submeshCount")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<202>");
				for(int t_ii=0;t_ii<=t_submeshCount-1;t_ii=t_ii+1){
					DBG_BLOCK();
					DBG_LOCAL(t_ii,"ii")
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<203>");
					m_cal_renderer->p_selectMeshSubmesh(t_cb3d->m_MID,t_ii);
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<204>");
					int t_vertexCount=m_cal_renderer->p_getVertexCount();
					DBG_LOCAL(t_vertexCount,"vertexCount")
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<205>");
					int t_faceCount=m_cal_renderer->p_getFaceCount();
					DBG_LOCAL(t_faceCount,"faceCount")
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<208>");
					Array<Float > t_vertices=Array<Float >(t_vertexCount*8);
					DBG_LOCAL(t_vertices,"vertices")
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<209>");
					Array<Float > t_texcoords=Array<Float >(t_vertexCount*3);
					DBG_LOCAL(t_texcoords,"texcoords")
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<210>");
					Array<int > t_faces=Array<int >(t_faceCount*3);
					DBG_LOCAL(t_faces,"faces")
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<211>");
					m_cal_renderer->p_getVerticesNormalsAndTexCoords(t_vertices,1);
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<212>");
					m_cal_renderer->p_getFaces(t_faces);
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<217>");
					t_cb3d->p_Update4(t_ii,t_vertices,t_faces);
				}
			}
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<228>");
	m_cal_renderer->p_endRendering();
	return 0;
}
void c_Cal3dB3d::mark(){
	Object::mark();
	gc_mark_q(m_B3dModel);
	gc_mark_q(m_Meshes);
	gc_mark_q(m_Anims);
	gc_mark_q(m_CoreModel);
	gc_mark_q(m_Skele);
	gc_mark_q(m_CModel);
	gc_mark_q(m_cal_renderer);
}
String c_Cal3dB3d::debug(){
	String t="(Cal3dB3d)\n";
	t+=dbg_decl("Skele",&m_Skele);
	t+=dbg_decl("CoreModel",&m_CoreModel);
	t+=dbg_decl("Meshes",&m_Meshes);
	t+=dbg_decl("Anims",&m_Anims);
	t+=dbg_decl("CModel",&m_CModel);
	t+=dbg_decl("B3dModel",&m_B3dModel);
	t+=dbg_decl("cal_renderer",&m_cal_renderer);
	t+=dbg_decl("isloaded",&m_isloaded);
	return t;
}
c_Cal3dB3dMesh::c_Cal3dB3dMesh(){
	m_MID=0;
	m_CMesh=0;
	m_B3dMesh=0;
	m_surf=Array<c_TSurface* >(0);
}
c_Cal3dB3dMesh* c_Cal3dB3dMesh::m_new(){
	DBG_ENTER("Cal3dB3dMesh.new")
	c_Cal3dB3dMesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<5>");
	return this;
}
int c_Cal3dB3dMesh::p_Build2(Array<Float > t_v,Array<int > t_f){
	DBG_ENTER("Cal3dB3dMesh.Build")
	c_Cal3dB3dMesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_v,"v")
	DBG_LOCAL(t_f,"f")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<16>");
	if(m_CMesh==0){
		DBG_BLOCK();
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<17>");
	if(m_B3dMesh==0){
		DBG_BLOCK();
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<18>");
	int t_ind=m_surf.Length();
	DBG_LOCAL(t_ind,"ind")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<19>");
	gc_assign(m_surf,m_surf.Resize(m_surf.Length()+1));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<21>");
	gc_assign(m_surf.At(t_ind),m_B3dMesh->p_CreateSurface(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<25>");
	for(int t_i=0;t_i<=t_v.Length()-1;t_i=t_i+3){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<26>");
		m_surf.At(t_ind)->p_AddVertex(t_v.At(t_i),t_v.At(t_i+1),-t_v.At(t_i+2),FLOAT(0.0),FLOAT(0.0),FLOAT(0.0));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<28>");
	m_surf.At(t_ind)->p_AddTriangle2(t_f,-1);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<30>");
	m_surf.At(t_ind)->p_UpdateNormals(false);
	return 0;
}
int c_Cal3dB3dMesh::p_Update4(int t_si,Array<Float > t_v,Array<int > t_f){
	DBG_ENTER("Cal3dB3dMesh.Update")
	c_Cal3dB3dMesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_si,"si")
	DBG_LOCAL(t_v,"v")
	DBG_LOCAL(t_f,"f")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<35>");
	m_surf.At(t_si)->p_ClearSurface(true,true,false);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<37>");
	for(int t_i=0;t_i<=t_v.Length()-1;t_i=t_i+8){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<38>");
		int t_vid=m_surf.At(t_si)->p_AddVertex(t_v.At(t_i),t_v.At(t_i+1),-t_v.At(t_i+2),FLOAT(0.0),FLOAT(0.0),FLOAT(0.0));
		DBG_LOCAL(t_vid,"vid")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<39>");
		m_surf.At(t_si)->p_VertexNormal(t_vid,t_v.At(t_i+3),t_v.At(t_i+4),-t_v.At(t_i+5));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<40>");
		m_surf.At(t_si)->p_VertexTexCoords(t_vid,t_v.At(t_i+6),t_v.At(t_i+7),FLOAT(0.0),0);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<43>");
	m_surf.At(t_si)->p_AddTriangle2(t_f,-1);
	return 0;
}
int c_Cal3dB3dMesh::p_Update5(int t_si,Array<Float > t_v,Array<Float > t_t,Array<int > t_f){
	DBG_ENTER("Cal3dB3dMesh.Update")
	c_Cal3dB3dMesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_si,"si")
	DBG_LOCAL(t_v,"v")
	DBG_LOCAL(t_t,"t")
	DBG_LOCAL(t_f,"f")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<48>");
	m_surf.At(t_si)->p_ClearSurface(true,true,false);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<50>");
	for(int t_i=0;t_i<=t_v.Length()-1;t_i=t_i+3){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<51>");
		int t_vid=m_surf.At(t_si)->p_AddVertex(t_v.At(t_i),t_v.At(t_i+1),-t_v.At(t_i+2),FLOAT(0.0),FLOAT(0.0),FLOAT(0.0));
		DBG_LOCAL(t_vid,"vid")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<52>");
		m_surf.At(t_si)->p_VertexNormal(t_vid,t_v.At(t_i+3),t_v.At(t_i+4),-t_v.At(t_i+5));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calb3d.monkey<56>");
	m_surf.At(t_si)->p_AddTriangle2(t_f,-1);
	return 0;
}
void c_Cal3dB3dMesh::mark(){
	Object::mark();
	gc_mark_q(m_CMesh);
	gc_mark_q(m_B3dMesh);
	gc_mark_q(m_surf);
}
String c_Cal3dB3dMesh::debug(){
	String t="(Cal3dB3dMesh)\n";
	t+=dbg_decl("B3dMesh",&m_B3dMesh);
	t+=dbg_decl("CMesh",&m_CMesh);
	t+=dbg_decl("MID",&m_MID);
	t+=dbg_decl("surf",&m_surf);
	return t;
}
c_List9::c_List9(){
	m__head=((new c_HeadNode9)->m_new());
}
c_List9* c_List9::m_new(){
	DBG_ENTER("List.new")
	c_List9 *self=this;
	DBG_LOCAL(self,"Self")
	return this;
}
c_Node11* c_List9::p_AddLast9(c_Cal3dB3dMesh* t_data){
	DBG_ENTER("List.AddLast")
	c_List9 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<108>");
	c_Node11* t_=(new c_Node11)->m_new(m__head,m__head->m__pred,t_data);
	return t_;
}
c_List9* c_List9::m_new2(Array<c_Cal3dB3dMesh* > t_data){
	DBG_ENTER("List.new")
	c_List9 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<13>");
	Array<c_Cal3dB3dMesh* > t_=t_data;
	int t_2=0;
	while(t_2<t_.Length()){
		DBG_BLOCK();
		c_Cal3dB3dMesh* t_t=t_.At(t_2);
		t_2=t_2+1;
		DBG_LOCAL(t_t,"t")
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<14>");
		p_AddLast9(t_t);
	}
	return this;
}
c_Enumerator14* c_List9::p_ObjectEnumerator(){
	DBG_ENTER("List.ObjectEnumerator")
	c_List9 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<186>");
	c_Enumerator14* t_=(new c_Enumerator14)->m_new(this);
	return t_;
}
void c_List9::mark(){
	Object::mark();
	gc_mark_q(m__head);
}
String c_List9::debug(){
	String t="(List)\n";
	t+=dbg_decl("_head",&m__head);
	return t;
}
c_Node11::c_Node11(){
	m__succ=0;
	m__pred=0;
	m__data=0;
}
c_Node11* c_Node11::m_new(c_Node11* t_succ,c_Node11* t_pred,c_Cal3dB3dMesh* t_data){
	DBG_ENTER("Node.new")
	c_Node11 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_succ,"succ")
	DBG_LOCAL(t_pred,"pred")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<261>");
	gc_assign(m__succ,t_succ);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<262>");
	gc_assign(m__pred,t_pred);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<263>");
	gc_assign(m__succ->m__pred,this);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<264>");
	gc_assign(m__pred->m__succ,this);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<265>");
	gc_assign(m__data,t_data);
	return this;
}
c_Node11* c_Node11::m_new2(){
	DBG_ENTER("Node.new")
	c_Node11 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<258>");
	return this;
}
void c_Node11::mark(){
	Object::mark();
	gc_mark_q(m__succ);
	gc_mark_q(m__pred);
	gc_mark_q(m__data);
}
String c_Node11::debug(){
	String t="(Node)\n";
	t+=dbg_decl("_succ",&m__succ);
	t+=dbg_decl("_pred",&m__pred);
	t+=dbg_decl("_data",&m__data);
	return t;
}
c_HeadNode9::c_HeadNode9(){
}
c_HeadNode9* c_HeadNode9::m_new(){
	DBG_ENTER("HeadNode.new")
	c_HeadNode9 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<310>");
	c_Node11::m_new2();
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<311>");
	gc_assign(m__succ,(this));
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<312>");
	gc_assign(m__pred,(this));
	return this;
}
void c_HeadNode9::mark(){
	c_Node11::mark();
}
String c_HeadNode9::debug(){
	String t="(HeadNode)\n";
	t=c_Node11::debug()+t;
	return t;
}
c_CalCoreAnimation::c_CalCoreAnimation(){
	m_m_listCoreTrack=Array<c_CalCoreTrack* >();
	m_m_duration=FLOAT(.0);
	m_m_listCallbacks=Array<c_CalCallbackRecord* >();
	m_m_name=String();
	m_m_filename=String();
}
Array<c_CalCoreTrack* > c_CalCoreAnimation::p_getListCoreTrack(){
	DBG_ENTER("CalCoreAnimation.getListCoreTrack")
	c_CalCoreAnimation *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreanimation.monkey<104>");
	return m_m_listCoreTrack;
}
Float c_CalCoreAnimation::p_getDuration(){
	DBG_ENTER("CalCoreAnimation.getDuration")
	c_CalCoreAnimation *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreanimation.monkey<45>");
	return m_m_duration;
}
Array<c_CalCallbackRecord* > c_CalCoreAnimation::p_getCallbackList(){
	DBG_ENTER("CalCoreAnimation.getCallbackList")
	c_CalCoreAnimation *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreanimation.monkey<96>");
	return m_m_listCallbacks;
}
c_CalCoreAnimation* c_CalCoreAnimation::m_new(){
	DBG_ENTER("CalCoreAnimation.new")
	c_CalCoreAnimation *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreanimation.monkey<14>");
	gc_assign(m_m_listCallbacks,Array<c_CalCallbackRecord* >(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreanimation.monkey<15>");
	m_m_duration=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreanimation.monkey<16>");
	gc_assign(m_m_listCoreTrack,Array<c_CalCoreTrack* >(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreanimation.monkey<17>");
	m_m_name=String(L"Animation",9);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreanimation.monkey<18>");
	m_m_filename=String();
	return this;
}
void c_CalCoreAnimation::p_setDuration(Float t_duration){
	DBG_ENTER("CalCoreAnimation.setDuration")
	c_CalCoreAnimation *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_duration,"duration")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreanimation.monkey<49>");
	m_m_duration=t_duration;
}
bool c_CalCoreAnimation::p_addCoreTrack(c_CalCoreTrack* t_coreTrack){
	DBG_ENTER("CalCoreAnimation.addCoreTrack")
	c_CalCoreAnimation *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_coreTrack,"coreTrack")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreanimation.monkey<23>");
	gc_assign(m_m_listCoreTrack,m_m_listCoreTrack.Resize(m_m_listCoreTrack.Length()+1));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreanimation.monkey<24>");
	gc_assign(m_m_listCoreTrack.At(m_m_listCoreTrack.Length()-1),t_coreTrack);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreanimation.monkey<25>");
	return true;
}
void c_CalCoreAnimation::mark(){
	Object::mark();
	gc_mark_q(m_m_listCoreTrack);
	gc_mark_q(m_m_listCallbacks);
}
String c_CalCoreAnimation::debug(){
	String t="(CalCoreAnimation)\n";
	t+=dbg_decl("m_listCallbacks",&m_m_listCallbacks);
	t+=dbg_decl("m_duration",&m_m_duration);
	t+=dbg_decl("m_listCoreTrack",&m_m_listCoreTrack);
	t+=dbg_decl("m_name",&m_m_name);
	t+=dbg_decl("m_filename",&m_m_filename);
	return t;
}
c_List10::c_List10(){
	m__head=((new c_HeadNode10)->m_new());
}
c_List10* c_List10::m_new(){
	DBG_ENTER("List.new")
	c_List10 *self=this;
	DBG_LOCAL(self,"Self")
	return this;
}
c_Node12* c_List10::p_AddLast10(c_CalCoreAnimation* t_data){
	DBG_ENTER("List.AddLast")
	c_List10 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<108>");
	c_Node12* t_=(new c_Node12)->m_new(m__head,m__head->m__pred,t_data);
	return t_;
}
c_List10* c_List10::m_new2(Array<c_CalCoreAnimation* > t_data){
	DBG_ENTER("List.new")
	c_List10 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<13>");
	Array<c_CalCoreAnimation* > t_=t_data;
	int t_2=0;
	while(t_2<t_.Length()){
		DBG_BLOCK();
		c_CalCoreAnimation* t_t=t_.At(t_2);
		t_2=t_2+1;
		DBG_LOCAL(t_t,"t")
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<14>");
		p_AddLast10(t_t);
	}
	return this;
}
void c_List10::mark(){
	Object::mark();
	gc_mark_q(m__head);
}
String c_List10::debug(){
	String t="(List)\n";
	t+=dbg_decl("_head",&m__head);
	return t;
}
c_Node12::c_Node12(){
	m__succ=0;
	m__pred=0;
	m__data=0;
}
c_Node12* c_Node12::m_new(c_Node12* t_succ,c_Node12* t_pred,c_CalCoreAnimation* t_data){
	DBG_ENTER("Node.new")
	c_Node12 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_succ,"succ")
	DBG_LOCAL(t_pred,"pred")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<261>");
	gc_assign(m__succ,t_succ);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<262>");
	gc_assign(m__pred,t_pred);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<263>");
	gc_assign(m__succ->m__pred,this);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<264>");
	gc_assign(m__pred->m__succ,this);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<265>");
	gc_assign(m__data,t_data);
	return this;
}
c_Node12* c_Node12::m_new2(){
	DBG_ENTER("Node.new")
	c_Node12 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<258>");
	return this;
}
void c_Node12::mark(){
	Object::mark();
	gc_mark_q(m__succ);
	gc_mark_q(m__pred);
	gc_mark_q(m__data);
}
String c_Node12::debug(){
	String t="(Node)\n";
	t+=dbg_decl("_succ",&m__succ);
	t+=dbg_decl("_pred",&m__pred);
	t+=dbg_decl("_data",&m__data);
	return t;
}
c_HeadNode10::c_HeadNode10(){
}
c_HeadNode10* c_HeadNode10::m_new(){
	DBG_ENTER("HeadNode.new")
	c_HeadNode10 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<310>");
	c_Node12::m_new2();
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<311>");
	gc_assign(m__succ,(this));
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<312>");
	gc_assign(m__pred,(this));
	return this;
}
void c_HeadNode10::mark(){
	c_Node12::mark();
}
String c_HeadNode10::debug(){
	String t="(HeadNode)\n";
	t=c_Node12::debug()+t;
	return t;
}
c_CalCoreModel::c_CalCoreModel(){
	m_m_name=String();
	m_m_coreSkeleton=0;
	m_m_vectorCoreAnimation=Array<c_CalCoreAnimation* >();
	m_m_vectorCoreMorphAnimation=Array<c_CalCoreMorphAnimation* >();
	m_m_vectorCoreMesh=Array<c_CalCoreMesh* >();
	m_m_vectorCoreMaterial=Array<c_CalCoreMaterial* >();
	m_m_mapmapCoreMaterialThread=0;
	m_m_animationName=0;
	m_m_materialName=0;
	m_m_meshName=0;
}
c_CalCoreModel* c_CalCoreModel::m_new(String t_name){
	DBG_ENTER("CalCoreModel.new")
	c_CalCoreModel *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_name,"name")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremodel.monkey<20>");
	m_m_name=t_name;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremodel.monkey<21>");
	m_m_coreSkeleton=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremodel.monkey<22>");
	gc_assign(m_m_vectorCoreAnimation,Array<c_CalCoreAnimation* >(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremodel.monkey<23>");
	gc_assign(m_m_vectorCoreMorphAnimation,Array<c_CalCoreMorphAnimation* >(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremodel.monkey<24>");
	gc_assign(m_m_vectorCoreMesh,Array<c_CalCoreMesh* >(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremodel.monkey<25>");
	gc_assign(m_m_vectorCoreMaterial,Array<c_CalCoreMaterial* >(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremodel.monkey<26>");
	gc_assign(m_m_mapmapCoreMaterialThread,(new c_IntMap3)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremodel.monkey<27>");
	gc_assign(m_m_animationName,(new c_StringMap)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremodel.monkey<28>");
	gc_assign(m_m_materialName,(new c_StringMap)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremodel.monkey<29>");
	gc_assign(m_m_meshName,(new c_StringMap)->m_new());
	return this;
}
void c_CalCoreModel::p_setCoreSkeleton(c_CalCoreSkeleton* t_coreSkeleton){
	DBG_ENTER("CalCoreModel.setCoreSkeleton")
	c_CalCoreModel *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_coreSkeleton,"coreSkeleton")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremodel.monkey<383>");
	if(t_coreSkeleton!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremodel.monkey<384>");
		gc_assign(m_m_coreSkeleton,t_coreSkeleton);
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremodel.monkey<386>");
		bbPrint(String(L"Cannot set NULL Skeleton!",25));
	}
}
int c_CalCoreModel::p_addCoreMesh(c_CalCoreMesh* t_coreMesh){
	DBG_ENTER("CalCoreModel.addCoreMesh")
	c_CalCoreModel *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_coreMesh,"coreMesh")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremodel.monkey<279>");
	int t_meshId=m_m_vectorCoreMesh.Length();
	DBG_LOCAL(t_meshId,"meshId")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremodel.monkey<280>");
	gc_assign(m_m_vectorCoreMesh,m_m_vectorCoreMesh.Resize(t_meshId+1));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremodel.monkey<281>");
	gc_assign(m_m_vectorCoreMesh.At(t_meshId),t_coreMesh);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremodel.monkey<282>");
	return t_meshId;
}
int c_CalCoreModel::p_addCoreAnimation(c_CalCoreAnimation* t_coreAnimation){
	DBG_ENTER("CalCoreModel.addCoreAnimation")
	c_CalCoreModel *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_coreAnimation,"coreAnimation")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremodel.monkey<57>");
	int t_animationId=m_m_vectorCoreAnimation.Length();
	DBG_LOCAL(t_animationId,"animationId")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremodel.monkey<58>");
	gc_assign(m_m_vectorCoreAnimation,m_m_vectorCoreAnimation.Resize(t_animationId+1));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremodel.monkey<59>");
	gc_assign(m_m_vectorCoreAnimation.At(t_animationId),t_coreAnimation);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremodel.monkey<60>");
	return t_animationId;
}
c_CalCoreSkeleton* c_CalCoreModel::p_getCoreSkeleton(){
	DBG_ENTER("CalCoreModel.getCoreSkeleton")
	c_CalCoreModel *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremodel.monkey<370>");
	return m_m_coreSkeleton;
}
int c_CalCoreModel::p_getCoreMeshCount(){
	DBG_ENTER("CalCoreModel.getCoreMeshCount")
	c_CalCoreModel *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremodel.monkey<299>");
	int t_=m_m_vectorCoreMesh.Length();
	return t_;
}
c_CalCoreMesh* c_CalCoreModel::p_getCoreMesh(int t_coreMeshId){
	DBG_ENTER("CalCoreModel.getCoreMesh")
	c_CalCoreModel *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_coreMeshId,"coreMeshId")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremodel.monkey<288>");
	if(t_coreMeshId<0 || t_coreMeshId>=m_m_vectorCoreMesh.Length()){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremodel.monkey<289>");
		bbPrint(String(L"Invalid Mesh ID",15));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremodel.monkey<290>");
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremodel.monkey<293>");
	return m_m_vectorCoreMesh.At(t_coreMeshId);
}
int c_CalCoreModel::p_getCoreAnimationCount(){
	DBG_ENTER("CalCoreModel.getCoreAnimationCount")
	c_CalCoreModel *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremodel.monkey<76>");
	int t_=m_m_vectorCoreAnimation.Length();
	return t_;
}
int c_CalCoreModel::p_getCoreMorphAnimationCount(){
	DBG_ENTER("CalCoreModel.getCoreMorphAnimationCount")
	c_CalCoreModel *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremodel.monkey<158>");
	int t_=m_m_vectorCoreMorphAnimation.Length();
	return t_;
}
c_CalModel* c_CalCoreModel::p_makemodel(){
	DBG_ENTER("CalCoreModel.makemodel")
	c_CalCoreModel *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremodel.monkey<364>");
	c_CalModel* t_=(new c_CalModel)->m_new2(this);
	return t_;
}
c_CalCoreAnimation* c_CalCoreModel::p_getCoreAnimation(int t_coreAnimationId){
	DBG_ENTER("CalCoreModel.getCoreAnimation")
	c_CalCoreModel *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_coreAnimationId,"coreAnimationId")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremodel.monkey<66>");
	if(t_coreAnimationId<0 || t_coreAnimationId>=m_m_vectorCoreAnimation.Length()){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremodel.monkey<67>");
		bbPrint(String(L"Invalid Animation ID",20));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremodel.monkey<68>");
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremodel.monkey<71>");
	return m_m_vectorCoreAnimation.At(t_coreAnimationId);
}
c_CalCoreMorphAnimation* c_CalCoreModel::p_getCoreMorphAnimation(int t_coreMorphAnimationId){
	DBG_ENTER("CalCoreModel.getCoreMorphAnimation")
	c_CalCoreModel *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_coreMorphAnimationId,"coreMorphAnimationId")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremodel.monkey<148>");
	if(t_coreMorphAnimationId<0 || t_coreMorphAnimationId>=m_m_vectorCoreMorphAnimation.Length()){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremodel.monkey<149>");
		bbPrint(String(L"Invalid Morph ID",16));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremodel.monkey<150>");
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremodel.monkey<153>");
	return m_m_vectorCoreMorphAnimation.At(t_coreMorphAnimationId);
}
void c_CalCoreModel::mark(){
	Object::mark();
	gc_mark_q(m_m_coreSkeleton);
	gc_mark_q(m_m_vectorCoreAnimation);
	gc_mark_q(m_m_vectorCoreMorphAnimation);
	gc_mark_q(m_m_vectorCoreMesh);
	gc_mark_q(m_m_vectorCoreMaterial);
	gc_mark_q(m_m_mapmapCoreMaterialThread);
	gc_mark_q(m_m_animationName);
	gc_mark_q(m_m_materialName);
	gc_mark_q(m_m_meshName);
}
String c_CalCoreModel::debug(){
	String t="(CalCoreModel)\n";
	t+=dbg_decl("m_name",&m_m_name);
	t+=dbg_decl("m_coreSkeleton",&m_m_coreSkeleton);
	t+=dbg_decl("m_vectorCoreAnimation",&m_m_vectorCoreAnimation);
	t+=dbg_decl("m_vectorCoreMorphAnimation",&m_m_vectorCoreMorphAnimation);
	t+=dbg_decl("m_vectorCoreMesh",&m_m_vectorCoreMesh);
	t+=dbg_decl("m_vectorCoreMaterial",&m_m_vectorCoreMaterial);
	t+=dbg_decl("m_mapmapCoreMaterialThread",&m_m_mapmapCoreMaterialThread);
	t+=dbg_decl("m_animationName",&m_m_animationName);
	t+=dbg_decl("m_materialName",&m_m_materialName);
	t+=dbg_decl("m_meshName",&m_m_meshName);
	return t;
}
c_CalCoreSkeleton::c_CalCoreSkeleton(){
	m_m_vectorCoreBone=Array<c_CalCoreBone* >();
	m_m_mapCoreBoneNames=0;
	m_m_vectorRootCoreBoneId=Array<int >();
}
int c_CalCoreSkeleton::p_getCoreBoneId(String t_name){
	DBG_ENTER("CalCoreSkeleton.getCoreBoneId")
	c_CalCoreSkeleton *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_name,"name")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreskeleton.monkey<69>");
	if(m_m_mapCoreBoneNames->p_Contains3(t_name)==true){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreskeleton.monkey<70>");
		int t_=m_m_mapCoreBoneNames->p_Get2(t_name);
		return t_;
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreskeleton.monkey<72>");
		return -1;
	}
}
void c_CalCoreSkeleton::p_calculateBoundingBoxes(c_CalCoreModel* t_coreModel){
	DBG_ENTER("CalCoreSkeleton.calculateBoundingBoxes")
	c_CalCoreSkeleton *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_coreModel,"coreModel")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreskeleton.monkey<98>");
	for(int t_boneId=0;t_boneId<=m_m_vectorCoreBone.Length()-1;t_boneId=t_boneId+1){
		DBG_BLOCK();
		DBG_LOCAL(t_boneId,"boneId")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreskeleton.monkey<100>");
		m_m_vectorCoreBone.At(t_boneId)->p_calculateBoundingBox(t_coreModel);
	}
}
Array<c_CalCoreBone* > c_CalCoreSkeleton::p_getVectorCoreBone(){
	DBG_ENTER("CalCoreSkeleton.getVectorCoreBone")
	c_CalCoreSkeleton *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreskeleton.monkey<94>");
	return m_m_vectorCoreBone;
}
Array<int > c_CalCoreSkeleton::p_getVectorRootCoreBoneId(){
	DBG_ENTER("CalCoreSkeleton.getVectorRootCoreBoneId")
	c_CalCoreSkeleton *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreskeleton.monkey<90>");
	return m_m_vectorRootCoreBoneId;
}
c_CalCoreSkeleton* c_CalCoreSkeleton::m_new(){
	DBG_ENTER("CalCoreSkeleton.new")
	c_CalCoreSkeleton *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreskeleton.monkey<12>");
	gc_assign(m_m_vectorCoreBone,Array<c_CalCoreBone* >(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreskeleton.monkey<13>");
	gc_assign(m_m_mapCoreBoneNames,(new c_StringMap)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreskeleton.monkey<14>");
	gc_assign(m_m_vectorRootCoreBoneId,Array<int >(0));
	return this;
}
bool c_CalCoreSkeleton::p_mapCoreBoneName(int t_coreBoneId,String t_name){
	DBG_ENTER("CalCoreSkeleton.mapCoreBoneName")
	c_CalCoreSkeleton *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_coreBoneId,"coreBoneId")
	DBG_LOCAL(t_name,"name")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreskeleton.monkey<79>");
	if(t_coreBoneId<0 || t_coreBoneId>=m_m_vectorCoreBone.Length()){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreskeleton.monkey<80>");
		return false;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreskeleton.monkey<83>");
	bool t_=m_m_mapCoreBoneNames->p_Add3(t_name,t_coreBoneId);
	return t_;
}
int c_CalCoreSkeleton::p_addCoreBone(c_CalCoreBone* t_coreBone){
	DBG_ENTER("CalCoreSkeleton.addCoreBone")
	c_CalCoreSkeleton *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_coreBone,"coreBone")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreskeleton.monkey<20>");
	int t_boneId=m_m_vectorCoreBone.Length();
	DBG_LOCAL(t_boneId,"boneId")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreskeleton.monkey<21>");
	gc_assign(m_m_vectorCoreBone,m_m_vectorCoreBone.Resize(t_boneId+1));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreskeleton.monkey<22>");
	gc_assign(m_m_vectorCoreBone.At(t_boneId),t_coreBone);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreskeleton.monkey<24>");
	if(t_coreBone->p_getParentId()==-1){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreskeleton.monkey<25>");
		int t_bn=m_m_vectorRootCoreBoneId.Length();
		DBG_LOCAL(t_bn,"bn")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreskeleton.monkey<26>");
		gc_assign(m_m_vectorRootCoreBoneId,m_m_vectorRootCoreBoneId.Resize(t_bn+1));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreskeleton.monkey<27>");
		m_m_vectorRootCoreBoneId.At(t_bn)=t_boneId;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreskeleton.monkey<31>");
	p_mapCoreBoneName(t_boneId,t_coreBone->p_getName());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreskeleton.monkey<33>");
	return t_boneId;
}
c_CalCoreBone* c_CalCoreSkeleton::p_getCoreBone(int t_coreBoneId){
	DBG_ENTER("CalCoreSkeleton.getCoreBone")
	c_CalCoreSkeleton *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_coreBoneId,"coreBoneId")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreskeleton.monkey<46>");
	if(t_coreBoneId<0 || t_coreBoneId>=m_m_vectorCoreBone.Length()){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreskeleton.monkey<47>");
		bbPrint(String(L"Invalid Bone ID",15));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreskeleton.monkey<48>");
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreskeleton.monkey<51>");
	return m_m_vectorCoreBone.At(t_coreBoneId);
}
c_CalCoreBone* c_CalCoreSkeleton::p_getCoreBone2(String t_coreBoneId){
	DBG_ENTER("CalCoreSkeleton.getCoreBone")
	c_CalCoreSkeleton *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_coreBoneId,"coreBoneId")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreskeleton.monkey<57>");
	int t_bid=p_getCoreBoneId(t_coreBoneId);
	DBG_LOCAL(t_bid,"bid")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreskeleton.monkey<58>");
	if(t_bid<0 || t_bid>=m_m_vectorCoreBone.Length()){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreskeleton.monkey<59>");
		bbPrint(String(L"Invalid Bone ID",15));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreskeleton.monkey<60>");
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreskeleton.monkey<63>");
	return m_m_vectorCoreBone.At(t_bid);
}
void c_CalCoreSkeleton::p_calculateState(){
	DBG_ENTER("CalCoreSkeleton.calculateState")
	c_CalCoreSkeleton *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreskeleton.monkey<38>");
	for(int t_iRootCoreBoneId=0;t_iRootCoreBoneId<=m_m_vectorRootCoreBoneId.Length()-1;t_iRootCoreBoneId=t_iRootCoreBoneId+1){
		DBG_BLOCK();
		DBG_LOCAL(t_iRootCoreBoneId,"iRootCoreBoneId")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coreskeleton.monkey<39>");
		m_m_vectorCoreBone.At(m_m_vectorRootCoreBoneId.At(t_iRootCoreBoneId))->p_calculateState();
	}
}
void c_CalCoreSkeleton::mark(){
	Object::mark();
	gc_mark_q(m_m_vectorCoreBone);
	gc_mark_q(m_m_mapCoreBoneNames);
	gc_mark_q(m_m_vectorRootCoreBoneId);
}
String c_CalCoreSkeleton::debug(){
	String t="(CalCoreSkeleton)\n";
	t+=dbg_decl("m_vectorCoreBone",&m_m_vectorCoreBone);
	t+=dbg_decl("m_mapCoreBoneNames",&m_m_mapCoreBoneNames);
	t+=dbg_decl("m_vectorRootCoreBoneId",&m_m_vectorRootCoreBoneId);
	return t;
}
c_CalCoreMorphAnimation::c_CalCoreMorphAnimation(){
	m_m_vectorCoreMeshID=Array<int >();
	m_m_vectorMorphTargetID=Array<int >();
}
Array<int > c_CalCoreMorphAnimation::p_getVectorCoreMeshID(){
	DBG_ENTER("CalCoreMorphAnimation.getVectorCoreMeshID")
	c_CalCoreMorphAnimation *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremorphanimation.monkey<27>");
	return m_m_vectorCoreMeshID;
}
Array<int > c_CalCoreMorphAnimation::p_getVectorMorphTargetID(){
	DBG_ENTER("CalCoreMorphAnimation.getVectorMorphTargetID")
	c_CalCoreMorphAnimation *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremorphanimation.monkey<31>");
	return m_m_vectorMorphTargetID;
}
void c_CalCoreMorphAnimation::mark(){
	Object::mark();
	gc_mark_q(m_m_vectorCoreMeshID);
	gc_mark_q(m_m_vectorMorphTargetID);
}
String c_CalCoreMorphAnimation::debug(){
	String t="(CalCoreMorphAnimation)\n";
	t+=dbg_decl("m_vectorCoreMeshID",&m_m_vectorCoreMeshID);
	t+=dbg_decl("m_vectorMorphTargetID",&m_m_vectorMorphTargetID);
	return t;
}
c_CalCoreMesh::c_CalCoreMesh(){
	m_m_vectorCoreSubmesh=Array<c_CalCoreSubmesh* >();
}
int c_CalCoreMesh::p_getCoreSubmeshCount(){
	DBG_ENTER("CalCoreMesh.getCoreSubmeshCount")
	c_CalCoreMesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremesh.monkey<37>");
	int t_=m_m_vectorCoreSubmesh.Length();
	return t_;
}
c_CalCoreSubmesh* c_CalCoreMesh::p_getCoreSubmesh(int t_coreSubmeshId){
	DBG_ENTER("CalCoreMesh.getCoreSubmesh")
	c_CalCoreMesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_coreSubmeshId,"coreSubmeshId")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremesh.monkey<27>");
	if(t_coreSubmeshId<0 || t_coreSubmeshId>=m_m_vectorCoreSubmesh.Length()){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremesh.monkey<28>");
		bbPrint(String(L"Invalid Submesh Handle",22));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremesh.monkey<29>");
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremesh.monkey<32>");
	return m_m_vectorCoreSubmesh.At(t_coreSubmeshId);
}
Array<c_CalCoreSubmesh* > c_CalCoreMesh::p_getVectorCoreSubmesh(){
	DBG_ENTER("CalCoreMesh.getVectorCoreSubmesh")
	c_CalCoreMesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremesh.monkey<42>");
	return m_m_vectorCoreSubmesh;
}
c_CalCoreMesh* c_CalCoreMesh::m_new(){
	DBG_ENTER("CalCoreMesh.new")
	c_CalCoreMesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremesh.monkey<12>");
	gc_assign(m_m_vectorCoreSubmesh,Array<c_CalCoreSubmesh* >(0));
	return this;
}
int c_CalCoreMesh::p_addCoreSubmesh(c_CalCoreSubmesh* t_coreSubmesh){
	DBG_ENTER("CalCoreMesh.addCoreSubmesh")
	c_CalCoreMesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_coreSubmesh,"coreSubmesh")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremesh.monkey<18>");
	int t_submeshId=m_m_vectorCoreSubmesh.Length();
	DBG_LOCAL(t_submeshId,"submeshId")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremesh.monkey<19>");
	gc_assign(m_m_vectorCoreSubmesh,m_m_vectorCoreSubmesh.Resize(t_submeshId+1));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremesh.monkey<20>");
	gc_assign(m_m_vectorCoreSubmesh.At(t_submeshId),t_coreSubmesh);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coremesh.monkey<21>");
	return t_submeshId;
}
void c_CalCoreMesh::mark(){
	Object::mark();
	gc_mark_q(m_m_vectorCoreSubmesh);
}
String c_CalCoreMesh::debug(){
	String t="(CalCoreMesh)\n";
	t+=dbg_decl("m_vectorCoreSubmesh",&m_m_vectorCoreSubmesh);
	return t;
}
c_CalCoreMaterial::c_CalCoreMaterial(){
}
void c_CalCoreMaterial::mark(){
	Object::mark();
}
String c_CalCoreMaterial::debug(){
	String t="(CalCoreMaterial)\n";
	return t;
}
c_Map2::c_Map2(){
}
void c_Map2::mark(){
	Object::mark();
}
String c_Map2::debug(){
	String t="(Map)\n";
	return t;
}
c_IntMap2::c_IntMap2(){
}
void c_IntMap2::mark(){
	c_Map2::mark();
}
String c_IntMap2::debug(){
	String t="(IntMap)\n";
	t=c_Map2::debug()+t;
	return t;
}
c_Map3::c_Map3(){
}
c_Map3* c_Map3::m_new(){
	DBG_ENTER("Map.new")
	c_Map3 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<7>");
	return this;
}
void c_Map3::mark(){
	Object::mark();
}
String c_Map3::debug(){
	String t="(Map)\n";
	return t;
}
c_IntMap3::c_IntMap3(){
}
c_IntMap3* c_IntMap3::m_new(){
	DBG_ENTER("IntMap.new")
	c_IntMap3 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<534>");
	c_Map3::m_new();
	return this;
}
void c_IntMap3::mark(){
	c_Map3::mark();
}
String c_IntMap3::debug(){
	String t="(IntMap)\n";
	t=c_Map3::debug()+t;
	return t;
}
c_Map4::c_Map4(){
	m_root=0;
}
c_Map4* c_Map4::m_new(){
	DBG_ENTER("Map.new")
	c_Map4 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<7>");
	return this;
}
c_Node14* c_Map4::p_FindNode2(String t_key){
	DBG_ENTER("Map.FindNode")
	c_Map4 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_key,"key")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<157>");
	c_Node14* t_node=m_root;
	DBG_LOCAL(t_node,"node")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<159>");
	while((t_node)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<160>");
		int t_cmp=p_Compare3(t_key,t_node->m_key);
		DBG_LOCAL(t_cmp,"cmp")
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<161>");
		if(t_cmp>0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<162>");
			t_node=t_node->m_right;
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<163>");
			if(t_cmp<0){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<164>");
				t_node=t_node->m_left;
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<166>");
				return t_node;
			}
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<169>");
	return t_node;
}
bool c_Map4::p_Contains3(String t_key){
	DBG_ENTER("Map.Contains")
	c_Map4 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_key,"key")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<25>");
	bool t_=p_FindNode2(t_key)!=0;
	return t_;
}
int c_Map4::p_Get2(String t_key){
	DBG_ENTER("Map.Get")
	c_Map4 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_key,"key")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<101>");
	c_Node14* t_node=p_FindNode2(t_key);
	DBG_LOCAL(t_node,"node")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<102>");
	if((t_node)!=0){
		DBG_BLOCK();
		return t_node->m_value;
	}
	return 0;
}
int c_Map4::p_RotateLeft2(c_Node14* t_node){
	DBG_ENTER("Map.RotateLeft")
	c_Map4 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_node,"node")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<251>");
	c_Node14* t_child=t_node->m_right;
	DBG_LOCAL(t_child,"child")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<252>");
	gc_assign(t_node->m_right,t_child->m_left);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<253>");
	if((t_child->m_left)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<254>");
		gc_assign(t_child->m_left->m_parent,t_node);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<256>");
	gc_assign(t_child->m_parent,t_node->m_parent);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<257>");
	if((t_node->m_parent)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<258>");
		if(t_node==t_node->m_parent->m_left){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<259>");
			gc_assign(t_node->m_parent->m_left,t_child);
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<261>");
			gc_assign(t_node->m_parent->m_right,t_child);
		}
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<264>");
		gc_assign(m_root,t_child);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<266>");
	gc_assign(t_child->m_left,t_node);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<267>");
	gc_assign(t_node->m_parent,t_child);
	return 0;
}
int c_Map4::p_RotateRight2(c_Node14* t_node){
	DBG_ENTER("Map.RotateRight")
	c_Map4 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_node,"node")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<271>");
	c_Node14* t_child=t_node->m_left;
	DBG_LOCAL(t_child,"child")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<272>");
	gc_assign(t_node->m_left,t_child->m_right);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<273>");
	if((t_child->m_right)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<274>");
		gc_assign(t_child->m_right->m_parent,t_node);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<276>");
	gc_assign(t_child->m_parent,t_node->m_parent);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<277>");
	if((t_node->m_parent)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<278>");
		if(t_node==t_node->m_parent->m_right){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<279>");
			gc_assign(t_node->m_parent->m_right,t_child);
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<281>");
			gc_assign(t_node->m_parent->m_left,t_child);
		}
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<284>");
		gc_assign(m_root,t_child);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<286>");
	gc_assign(t_child->m_right,t_node);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<287>");
	gc_assign(t_node->m_parent,t_child);
	return 0;
}
int c_Map4::p_InsertFixup2(c_Node14* t_node){
	DBG_ENTER("Map.InsertFixup")
	c_Map4 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_node,"node")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<212>");
	while(((t_node->m_parent)!=0) && t_node->m_parent->m_color==-1 && ((t_node->m_parent->m_parent)!=0)){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<213>");
		if(t_node->m_parent==t_node->m_parent->m_parent->m_left){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<214>");
			c_Node14* t_uncle=t_node->m_parent->m_parent->m_right;
			DBG_LOCAL(t_uncle,"uncle")
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<215>");
			if(((t_uncle)!=0) && t_uncle->m_color==-1){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<216>");
				t_node->m_parent->m_color=1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<217>");
				t_uncle->m_color=1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<218>");
				t_uncle->m_parent->m_color=-1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<219>");
				t_node=t_uncle->m_parent;
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<221>");
				if(t_node==t_node->m_parent->m_right){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<222>");
					t_node=t_node->m_parent;
					DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<223>");
					p_RotateLeft2(t_node);
				}
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<225>");
				t_node->m_parent->m_color=1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<226>");
				t_node->m_parent->m_parent->m_color=-1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<227>");
				p_RotateRight2(t_node->m_parent->m_parent);
			}
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<230>");
			c_Node14* t_uncle2=t_node->m_parent->m_parent->m_left;
			DBG_LOCAL(t_uncle2,"uncle")
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<231>");
			if(((t_uncle2)!=0) && t_uncle2->m_color==-1){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<232>");
				t_node->m_parent->m_color=1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<233>");
				t_uncle2->m_color=1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<234>");
				t_uncle2->m_parent->m_color=-1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<235>");
				t_node=t_uncle2->m_parent;
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<237>");
				if(t_node==t_node->m_parent->m_left){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<238>");
					t_node=t_node->m_parent;
					DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<239>");
					p_RotateRight2(t_node);
				}
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<241>");
				t_node->m_parent->m_color=1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<242>");
				t_node->m_parent->m_parent->m_color=-1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<243>");
				p_RotateLeft2(t_node->m_parent->m_parent);
			}
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<247>");
	m_root->m_color=1;
	return 0;
}
bool c_Map4::p_Add3(String t_key,int t_value){
	DBG_ENTER("Map.Add")
	c_Map4 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_key,"key")
	DBG_LOCAL(t_value,"value")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<61>");
	c_Node14* t_node=m_root;
	DBG_LOCAL(t_node,"node")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<62>");
	c_Node14* t_parent=0;
	int t_cmp=0;
	DBG_LOCAL(t_parent,"parent")
	DBG_LOCAL(t_cmp,"cmp")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<64>");
	while((t_node)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<65>");
		t_parent=t_node;
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<66>");
		t_cmp=p_Compare3(t_key,t_node->m_key);
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<67>");
		if(t_cmp>0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<68>");
			t_node=t_node->m_right;
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<69>");
			if(t_cmp<0){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<70>");
				t_node=t_node->m_left;
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<72>");
				return false;
			}
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<76>");
	t_node=(new c_Node14)->m_new(t_key,t_value,-1,t_parent);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<78>");
	if((t_parent)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<79>");
		if(t_cmp>0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<80>");
			gc_assign(t_parent->m_right,t_node);
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<82>");
			gc_assign(t_parent->m_left,t_node);
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<84>");
		p_InsertFixup2(t_node);
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<86>");
		gc_assign(m_root,t_node);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<88>");
	return true;
}
void c_Map4::mark(){
	Object::mark();
	gc_mark_q(m_root);
}
String c_Map4::debug(){
	String t="(Map)\n";
	t+=dbg_decl("root",&m_root);
	return t;
}
c_StringMap::c_StringMap(){
}
c_StringMap* c_StringMap::m_new(){
	DBG_ENTER("StringMap.new")
	c_StringMap *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<551>");
	c_Map4::m_new();
	return this;
}
int c_StringMap::p_Compare3(String t_lhs,String t_rhs){
	DBG_ENTER("StringMap.Compare")
	c_StringMap *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_lhs,"lhs")
	DBG_LOCAL(t_rhs,"rhs")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<554>");
	int t_=t_lhs.Compare(t_rhs);
	return t_;
}
void c_StringMap::mark(){
	c_Map4::mark();
}
String c_StringMap::debug(){
	String t="(StringMap)\n";
	t=c_Map4::debug()+t;
	return t;
}
c_DeltaTimer::c_DeltaTimer(){
	m_targetfps=FLOAT(60.0);
	m_lastticks=FLOAT(.0);
	m_delta=FLOAT(.0);
	m_currentticks=FLOAT(.0);
	m_frametime=FLOAT(.0);
}
c_DeltaTimer* c_DeltaTimer::m_new(Float t_fps){
	DBG_ENTER("DeltaTimer.new")
	c_DeltaTimer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_fps,"fps")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/cal3d.monkey<42>");
	m_targetfps=t_fps;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/cal3d.monkey<43>");
	m_lastticks=Float(bb_app2_Millisecs());
	return this;
}
c_DeltaTimer* c_DeltaTimer::m_new2(){
	DBG_ENTER("DeltaTimer.new")
	c_DeltaTimer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/cal3d.monkey<33>");
	return this;
}
void c_DeltaTimer::p_UpdateDelta(){
	DBG_ENTER("DeltaTimer.UpdateDelta")
	c_DeltaTimer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/cal3d.monkey<47>");
	m_currentticks=Float(bb_app2_Millisecs());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/cal3d.monkey<48>");
	m_frametime=m_currentticks-m_lastticks;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/cal3d.monkey<49>");
	m_delta=m_frametime/(FLOAT(1000.0)/m_targetfps);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/cal3d.monkey<50>");
	m_lastticks=m_currentticks;
}
void c_DeltaTimer::mark(){
	Object::mark();
}
String c_DeltaTimer::debug(){
	String t="(DeltaTimer)\n";
	t+=dbg_decl("targetfps",&m_targetfps);
	t+=dbg_decl("currentticks",&m_currentticks);
	t+=dbg_decl("lastticks",&m_lastticks);
	t+=dbg_decl("frametime",&m_frametime);
	t+=dbg_decl("delta",&m_delta);
	return t;
}
c_TCamera* bb_functions_CreateCamera(c_TEntity* t_parent){
	DBG_ENTER("CreateCamera")
	DBG_LOCAL(t_parent,"parent")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/functions.monkey<433>");
	c_TCamera* t_=c_TCamera::m_CreateCamera(t_parent);
	return t_;
}
c_TBone::c_TBone(){
	m_rest_mat=(new c_Matrix)->m_new();
	m_mat2=(new c_Matrix)->m_new();
	m_tform_mat=(new c_Matrix)->m_new();
	m_inv_mat=(new c_Matrix)->m_new();
}
c_Matrix* c_TBone::m_t_mat;
c_Matrix* c_TBone::m_new_mat;
void c_TBone::p_UpdateMatrix(c_Matrix* t_mat0){
	DBG_ENTER("TBone.UpdateMatrix")
	c_TBone *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_mat0,"mat0")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<382>");
	m_loc_mat->p_Overwrite(t_mat0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<383>");
	m_mat2->p_Overwrite(m_loc_mat);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<387>");
	if(m_parent!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<389>");
		m_mat->p_Overwrite(m_parent->m_mat);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<390>");
		m_mat->p_Multiply(m_loc_mat);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<393>");
		m_gsx=m_parent->m_gsx*m_sx;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<394>");
		m_gsy=m_parent->m_gsy*m_sy;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<395>");
		m_gsz=m_parent->m_gsz*m_sz;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<401>");
	if(dynamic_cast<c_TBone*>(this->m_parent)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<403>");
		m_new_mat->p_Overwrite(dynamic_cast<c_TBone*>(m_parent)->m_mat2);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<404>");
		m_new_mat->p_Multiply(m_loc_mat);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<405>");
		m_mat2->p_Overwrite(m_new_mat);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<412>");
	m_tform_mat->p_Overwrite(m_mat2);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<413>");
	m_tform_mat->p_Multiply(m_inv_mat);
}
void c_TBone::m_UpdateNonBoneChild(c_TEntity* t_ent_p){
	DBG_ENTER("TBone.UpdateNonBoneChild")
	DBG_LOCAL(t_ent_p,"ent_p")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<137>");
	if(dynamic_cast<c_TBone*>(t_ent_p)==0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<139>");
		m_new_mat->p_Overwrite(t_ent_p->m_parent->m_mat);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<142>");
		if(dynamic_cast<c_TBone*>(t_ent_p)!=0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<143>");
			m_new_mat->m_grid.At(3).At(2)=-m_new_mat->m_grid.At(3).At(2);
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<148>");
		t_ent_p->m_mat->p_Overwrite(m_new_mat);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<149>");
		t_ent_p->p_UpdateMat(false);
	}
}
void c_TBone::m_UpdateBoneChildren(c_TEntity* t_p){
	DBG_ENTER("TBone.UpdateBoneChildren")
	DBG_LOCAL(t_p,"p")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<158>");
	c_Enumerator7* t_=t_p->m_child_list->p_ObjectEnumerator();
	while(t_->p_HasNext()){
		DBG_BLOCK();
		c_TEntity* t_ent=t_->p_NextObject();
		DBG_LOCAL(t_ent,"ent")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<159>");
		c_TBone* t_bo=dynamic_cast<c_TBone*>(t_ent);
		DBG_LOCAL(t_bo,"bo")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<161>");
		if(t_bo!=0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<163>");
			t_bo->p_UpdateMatrix(t_bo->m_loc_mat);
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<167>");
			m_UpdateNonBoneChild(t_ent);
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<172>");
		m_UpdateBoneChildren(t_ent);
	}
}
int c_TBone::p_PositionBone(Float t_x,Float t_y,Float t_z,int t_glob){
	DBG_ENTER("TBone.PositionBone")
	c_TBone *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_x,"x")
	DBG_LOCAL(t_y,"y")
	DBG_LOCAL(t_z,"z")
	DBG_LOCAL(t_glob,"glob")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<181>");
	m_px=t_x;
	m_py=t_y;
	m_pz=t_z;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<184>");
	m_t_mat->p_Overwrite(m_rest_mat);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<185>");
	m_t_mat->p_Multiply(m_loc_mat);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<187>");
	m_t_mat->m_grid.At(3).At(0)=t_x+m_rest_mat->m_grid.At(3).At(0);
	m_t_mat->m_grid.At(3).At(1)=t_y+m_rest_mat->m_grid.At(3).At(1);
	m_t_mat->m_grid.At(3).At(2)=t_z+m_rest_mat->m_grid.At(3).At(2);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<191>");
	p_UpdateMatrix(m_t_mat);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<194>");
	if(this->m_child_list->p_IsEmpty()!=true){
		DBG_BLOCK();
		m_UpdateBoneChildren(this);
	}
	return 0;
}
int c_TBone::p_RotateBone(Float t_x,Float t_y,Float t_z,int t_glob){
	DBG_ENTER("TBone.RotateBone")
	c_TBone *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_x,"x")
	DBG_LOCAL(t_y,"y")
	DBG_LOCAL(t_z,"z")
	DBG_LOCAL(t_glob,"glob")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<203>");
	m_rx=-t_x;
	m_ry=t_y;
	m_rz=t_z;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<206>");
	m_t_mat->p_Overwrite(m_rest_mat);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<207>");
	m_t_mat->m_grid.At(3).At(0)=m_px+m_rest_mat->m_grid.At(3).At(0);
	m_t_mat->m_grid.At(3).At(1)=m_py+m_rest_mat->m_grid.At(3).At(1);
	m_t_mat->m_grid.At(3).At(2)=m_pz+m_rest_mat->m_grid.At(3).At(2);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<209>");
	m_t_mat->p_Rotate(t_x,t_y,t_z);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<213>");
	p_UpdateMatrix(m_t_mat);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<216>");
	if(this->m_child_list->p_IsEmpty()!=true){
		DBG_BLOCK();
		m_UpdateBoneChildren(this);
	}
	return 0;
}
int c_TBone::p_ScaleBone(Float t_x,Float t_y,Float t_z,int t_glob){
	DBG_ENTER("TBone.ScaleBone")
	c_TBone *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_x,"x")
	DBG_LOCAL(t_y,"y")
	DBG_LOCAL(t_z,"z")
	DBG_LOCAL(t_glob,"glob")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<223>");
	m_sx=t_x;
	m_sy=t_y;
	m_sz=t_z;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<226>");
	m_t_mat->p_Overwrite(m_rest_mat);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<229>");
	m_t_mat->m_grid.At(3).At(0)=m_px+m_rest_mat->m_grid.At(3).At(0);
	m_t_mat->m_grid.At(3).At(1)=m_py+m_rest_mat->m_grid.At(3).At(1);
	m_t_mat->m_grid.At(3).At(2)=m_pz+m_rest_mat->m_grid.At(3).At(2);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<230>");
	m_t_mat->p_Rotate(m_rx,m_ry,m_rz);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<231>");
	m_t_mat->p_Scale(t_x,t_y,t_z);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<234>");
	p_UpdateMatrix(m_t_mat);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<239>");
	m_gsx=m_parent->m_gsx*m_sx;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<240>");
	m_gsy=m_parent->m_gsy*m_sy;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<241>");
	m_gsz=m_parent->m_gsz*m_sz;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tbone.monkey<243>");
	if(this->m_child_list->p_IsEmpty()!=true){
		DBG_BLOCK();
		m_UpdateBoneChildren(this);
	}
	return 0;
}
void c_TBone::mark(){
	c_TEntity::mark();
	gc_mark_q(m_rest_mat);
	gc_mark_q(m_mat2);
	gc_mark_q(m_tform_mat);
	gc_mark_q(m_inv_mat);
}
String c_TBone::debug(){
	String t="(TBone)\n";
	t=c_TEntity::debug()+t;
	t+=dbg_decl("mat2",&m_mat2);
	t+=dbg_decl("inv_mat",&m_inv_mat);
	t+=dbg_decl("tform_mat",&m_tform_mat);
	t+=dbg_decl("rest_mat",&m_rest_mat);
	t+=dbg_decl("new_mat",&c_TBone::m_new_mat);
	t+=dbg_decl("t_mat",&c_TBone::m_t_mat);
	return t;
}
c_Line::c_Line(){
	m_o=0;
	m_d=0;
}
c_Line* c_Line::m_new(){
	DBG_ENTER("Line.new")
	c_Line *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/geom.monkey<12>");
	gc_assign(m_o,(new c_Vector)->m_new(FLOAT(0.0),FLOAT(0.0),FLOAT(0.0)));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/geom.monkey<13>");
	gc_assign(m_d,(new c_Vector)->m_new(FLOAT(0.0),FLOAT(0.0),FLOAT(0.0)));
	return this;
}
c_Line* c_Line::m_new2(c_Vector* t_oo,c_Vector* t_dd){
	DBG_ENTER("Line.new")
	c_Line *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_oo,"oo")
	DBG_LOCAL(t_dd,"dd")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/geom.monkey<17>");
	gc_assign(m_o,t_oo->p_Copy());
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/geom.monkey<18>");
	gc_assign(m_d,t_dd->p_Copy());
	return this;
}
c_Line* c_Line::m_new3(Float t_ox,Float t_oy,Float t_oz,Float t_dx,Float t_dy,Float t_dz){
	DBG_ENTER("Line.new")
	c_Line *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_ox,"ox")
	DBG_LOCAL(t_oy,"oy")
	DBG_LOCAL(t_oz,"oz")
	DBG_LOCAL(t_dx,"dx")
	DBG_LOCAL(t_dy,"dy")
	DBG_LOCAL(t_dz,"dz")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/geom.monkey<23>");
	gc_assign(m_o,(new c_Vector)->m_new(t_ox,t_oy,t_oz));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/geom.monkey<24>");
	gc_assign(m_d,(new c_Vector)->m_new(t_dx,t_dy,t_dz));
	return this;
}
void c_Line::mark(){
	Object::mark();
	gc_mark_q(m_o);
	gc_mark_q(m_d);
}
String c_Line::debug(){
	String t="(Line)\n";
	t+=dbg_decl("o",&m_o);
	t+=dbg_decl("d",&m_d);
	return t;
}
c_TLight* bb_functions_CreateLight(int t_light_type,c_TEntity* t_parent){
	DBG_ENTER("CreateLight")
	DBG_LOCAL(t_light_type,"light_type")
	DBG_LOCAL(t_parent,"parent")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/functions.monkey<473>");
	c_TLight* t_=c_TLight::m_CreateLight(t_light_type,t_parent);
	return t_;
}
c_TMesh* bb_functions_CreateCube(c_TEntity* t_parent){
	DBG_ENTER("CreateCube")
	DBG_LOCAL(t_parent,"parent")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/functions.monkey<454>");
	c_TMesh* t_=c_TMesh::m_CreateCube(t_parent);
	return t_;
}
c_TText::c_TText(){
	m_text=String();
	m_length=0;
	m_cam=0;
	m_char_pixels=FLOAT(.0);
	m_font_file=String();
	m_orig_width=FLOAT(.0);
	m_orig_height=FLOAT(.0);
	m_surf=0;
	m_char_rows=0;
	m_pixel_ratio=FLOAT(.0);
	m_char_uvwidth=FLOAT(.0);
	m_padding=0;
	m_mode=true;
	m_old_text=String();
}
c_TText* c_TText::m_new(){
	DBG_ENTER("TText.new")
	c_TText *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<9>");
	c_TSprite::m_new();
	return this;
}
int c_TText::m_mask_color;
int c_TText::p_AddChar(int t_char,int t_num,Float t_x,Float t_y,Float t_offset){
	DBG_ENTER("TText.AddChar")
	c_TText *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_char,"char")
	DBG_LOCAL(t_num,"num")
	DBG_LOCAL(t_x,"x")
	DBG_LOCAL(t_y,"y")
	DBG_LOCAL(t_offset,"offset")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<158>");
	Float t_uv=(Float(t_char)-FLOAT(32.0))*m_char_uvwidth+(Float(t_char)-FLOAT(32.0))*Float(m_padding);
	DBG_LOCAL(t_uv,"uv")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<159>");
	Float t_uv2=FLOAT(0.9999);
	DBG_LOCAL(t_uv2,"uv2")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<161>");
	if(t_char==32){
		DBG_BLOCK();
		t_uv=FLOAT(0.0);
		t_uv2=FLOAT(0.0001);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<162>");
	if(t_uv<FLOAT(0.0)){
		DBG_BLOCK();
		t_uv=FLOAT(0.0);
		t_uv2=FLOAT(0.0001);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<166>");
	Float t_kern=FLOAT(0.3)*t_x+t_offset;
	DBG_LOCAL(t_kern,"kern")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<168>");
	m_surf->p_AddVertex(FLOAT(0.0)+t_x-t_kern,FLOAT(0.0)+t_y,FLOAT(0.0),t_uv,t_uv2,FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<169>");
	m_surf->p_AddVertex(FLOAT(0.0)+t_x-t_kern,FLOAT(1.0)+t_y,FLOAT(0.0),t_uv,FLOAT(0.0001),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<170>");
	m_surf->p_AddVertex(FLOAT(1.0)+t_x-t_kern,FLOAT(1.0)+t_y,FLOAT(0.0),t_uv+m_char_uvwidth,FLOAT(0.0001),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<171>");
	m_surf->p_AddVertex(FLOAT(1.0)+t_x-t_kern,FLOAT(0.0)+t_y,FLOAT(0.0),t_uv+m_char_uvwidth,t_uv2,FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<172>");
	int t_v=t_num*4;
	DBG_LOCAL(t_v,"v")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<173>");
	m_surf->p_AddTriangle(0+t_v,1+t_v,2+t_v);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<174>");
	m_surf->p_AddTriangle(0+t_v,2+t_v,3+t_v);
	return 0;
}
int c_TText::p_AdjustChar(int t_char,int t_num,Float t_x,Float t_y){
	DBG_ENTER("TText.AdjustChar")
	c_TText *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_char,"char")
	DBG_LOCAL(t_num,"num")
	DBG_LOCAL(t_x,"x")
	DBG_LOCAL(t_y,"y")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<180>");
	Float t_uv=(Float(t_char)-FLOAT(32.0))*m_char_uvwidth+(Float(t_char)-FLOAT(32.0))*Float(m_padding);
	DBG_LOCAL(t_uv,"uv")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<181>");
	Float t_uv2=FLOAT(0.9999);
	DBG_LOCAL(t_uv2,"uv2")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<183>");
	if(t_char==32){
		DBG_BLOCK();
		t_uv=FLOAT(0.0);
		t_uv2=FLOAT(0.0001);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<184>");
	if(t_uv<FLOAT(0.0)){
		DBG_BLOCK();
		t_uv=FLOAT(0.0);
		t_uv2=FLOAT(0.0001);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<187>");
	Float t_kern=FLOAT(0.3)*t_x;
	DBG_LOCAL(t_kern,"kern")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<189>");
	int t_v=t_num*4;
	DBG_LOCAL(t_v,"v")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<190>");
	m_surf->p_VertexTexCoords(t_v+0,t_uv,t_uv2,FLOAT(0.0),0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<191>");
	m_surf->p_VertexTexCoords(t_v+1,t_uv,FLOAT(0.0001),FLOAT(0.0),0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<192>");
	m_surf->p_VertexTexCoords(t_v+2,t_uv+m_char_uvwidth,FLOAT(0.0001),FLOAT(0.0),0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<193>");
	m_surf->p_VertexTexCoords(t_v+3,t_uv+m_char_uvwidth,t_uv2,FLOAT(0.0),0);
	return 0;
}
int c_TText::p_SetText(String t_str,Float t_x,Float t_y,Float t_z,int t_align){
	DBG_ENTER("TText.SetText")
	c_TText *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_str,"str")
	DBG_LOCAL(t_x,"x")
	DBG_LOCAL(t_y,"y")
	DBG_LOCAL(t_z,"z")
	DBG_LOCAL(t_align,"align")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<211>");
	int t_resurf=0;
	DBG_LOCAL(t_resurf,"resurf")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<213>");
	if(m_mode==false){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<215>");
		p_PositionEntity(t_x,t_y,t_z,0);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<231>");
	if(t_str==m_old_text || t_str==String()){
		DBG_BLOCK();
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<233>");
	if(t_str.Length()!=m_old_text.Length()){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<234>");
		if((m_surf)!=0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<235>");
			m_surf->p_ClearSurface(true,true,false);
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<237>");
			gc_assign(m_surf,p_CreateSurface(0));
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<240>");
		t_resurf=1;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<245>");
	m_old_text=t_str;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<247>");
	int t_nl=-1;
	int t_xx=0;
	int t_total=0;
	DBG_LOCAL(t_nl,"nl")
	DBG_LOCAL(t_xx,"xx")
	DBG_LOCAL(t_total,"total")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<250>");
	Float t_offset=FLOAT(0.0);
	DBG_LOCAL(t_offset,"offset")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<251>");
	if(t_align==1){
		DBG_BLOCK();
		t_offset=Float(t_str.Length())*FLOAT(0.15);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<253>");
	for(int t_i=0;t_i<=t_str.Length()-1;t_i=t_i+1){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<255>");
		if((int)t_str.At(t_i)==13 || (int)t_str.At(t_i)==10){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<256>");
			t_nl=t_nl-1;
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<257>");
			t_xx=0;
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<258>");
			continue;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<261>");
		if((t_resurf)!=0){
			DBG_BLOCK();
			p_AddChar((int)t_str.At(t_i),t_total,Float(t_xx),Float(t_nl),t_offset);
		}else{
			DBG_BLOCK();
			p_AdjustChar((int)t_str.At(t_i),t_total,Float(t_xx),Float(t_nl));
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<262>");
		t_xx+=1;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<263>");
		t_total+=1;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<266>");
	if((t_resurf)!=0){
		DBG_BLOCK();
		m_surf->p_CropSurfaceBuffers();
	}
	return 0;
}
c_TText* c_TText::m_CreateText(c_TCamera* t_camx,String t_str,String t_font,int t_num_chars,int t_c_pixels,Float t_pad,bool t_mode){
	DBG_ENTER("TText.CreateText")
	DBG_LOCAL(t_camx,"camx")
	DBG_LOCAL(t_str,"str")
	DBG_LOCAL(t_font,"font")
	DBG_LOCAL(t_num_chars,"num_chars")
	DBG_LOCAL(t_c_pixels,"c_pixels")
	DBG_LOCAL(t_pad,"pad")
	DBG_LOCAL(t_mode,"mode")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<57>");
	c_TText* t_tt=(new c_TText)->m_new();
	DBG_LOCAL(t_tt,"tt")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<59>");
	gc_assign(t_tt->m_entity_link,c_TEntity::m_entity_list->p_EntityListAdd(t_tt));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<61>");
	t_tt->m_text=t_str;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<62>");
	t_tt->m_length=t_str.Length();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<63>");
	gc_assign(t_tt->m_cam,t_camx);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<64>");
	t_tt->m_classname=String(L"TextSprite",10);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<65>");
	t_tt->m_is_sprite=true;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<67>");
	t_tt->m_char_pixels=Float(t_c_pixels);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<69>");
	if(t_font!=String()){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<70>");
		t_tt->m_font_file=t_font;
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<73>");
		t_tt->m_font_file=String(L"mojo_font.png",13);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<77>");
	c_TTexture::m_useGlobalResizeSmooth=false;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<80>");
	c_TPixmap* t_pixmap=c_TPixmap::m_LoadPixmap(t_tt->m_font_file)->p_Copy();
	DBG_LOCAL(t_pixmap,"pixmap")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<81>");
	t_tt->m_orig_width=Float(t_pixmap->m_width);
	t_tt->m_orig_height=Float(t_pixmap->m_height);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<83>");
	if(t_pixmap->m_height==0){
		DBG_BLOCK();
		bbPrint(String(L"Font file not found.",20));
		return t_tt;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<86>");
	t_pixmap->p_MaskPixmap(m_mask_color&255,(m_mask_color&65280)>>8,(m_mask_color&16711680)>>16);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<87>");
	c_TTexture* t_tex=c_TTexture::m_LoadTexture2(t_pixmap,3,0);
	DBG_LOCAL(t_tex,"tex")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<90>");
	c_TTexture::m_useGlobalResizeSmooth=true;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<92>");
	t_tex->m_is_font=true;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<93>");
	t_tex->m_flags=50;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<94>");
	t_tex->p_TextureBlend(2);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<96>");
	t_tt->p_EntityShininess(FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<98>");
	gc_assign(t_tt->m_surf,t_tt->p_CreateSurface(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<99>");
	t_tt->p_EntityTexture(t_tex,0,0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<100>");
	t_tt->m_char_rows=int((Float)ceil((Float(t_c_pixels*t_num_chars)+Float(t_num_chars)*(t_pad*FLOAT(2.0)))/t_tt->m_orig_width));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<102>");
	t_tt->m_pixel_ratio=Float(t_tex->m_width)/t_tt->m_orig_width;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<104>");
	int t_temp_chars_per_row=int((Float)floor(Float(t_num_chars/t_tt->m_char_rows)));
	DBG_LOCAL(t_temp_chars_per_row,"temp_chars_per_row")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<105>");
	t_tt->m_char_uvwidth=t_tt->m_char_pixels*t_tt->m_pixel_ratio/Float(t_tex->m_width);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<106>");
	t_tt->m_padding=int(t_tt->m_pixel_ratio*t_pad);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<112>");
	if(t_tt->m_parent!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<113>");
		t_tt->m_mat->p_Overwrite(t_tt->m_parent->m_mat);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<114>");
		t_tt->p_UpdateMat(false);
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<116>");
		t_tt->p_UpdateMat(true);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<119>");
	t_tt->p_EntityFX(33);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<120>");
	t_tt->p_SetText(t_str,FLOAT(0.0),FLOAT(0.0),FLOAT(0.0),0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<122>");
	return t_tt;
}
c_TText* c_TText::m_CreateText2D(c_TCamera* t_camx,String t_str,String t_font,int t_num_chars,int t_c_pixels,int t_pad){
	DBG_ENTER("TText.CreateText2D")
	DBG_LOCAL(t_camx,"camx")
	DBG_LOCAL(t_str,"str")
	DBG_LOCAL(t_font,"font")
	DBG_LOCAL(t_num_chars,"num_chars")
	DBG_LOCAL(t_c_pixels,"c_pixels")
	DBG_LOCAL(t_pad,"pad")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<49>");
	c_TText* t_tt=m_CreateText(t_camx,t_str,t_font,t_num_chars,t_c_pixels,Float(t_pad),true);
	DBG_LOCAL(t_tt,"tt")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<50>");
	t_tt->p_HideEntity();
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttext.monkey<51>");
	return t_tt;
}
void c_TText::mark(){
	c_TSprite::mark();
	gc_mark_q(m_cam);
	gc_mark_q(m_surf);
}
String c_TText::debug(){
	String t="(TText)\n";
	t=c_TSprite::debug()+t;
	t+=dbg_decl("cam",&m_cam);
	t+=dbg_decl("mode",&m_mode);
	t+=dbg_decl("text",&m_text);
	t+=dbg_decl("old_text",&m_old_text);
	t+=dbg_decl("length",&m_length);
	t+=dbg_decl("font_file",&m_font_file);
	t+=dbg_decl("orig_width",&m_orig_width);
	t+=dbg_decl("orig_height",&m_orig_height);
	t+=dbg_decl("char_uvwidth",&m_char_uvwidth);
	t+=dbg_decl("surf",&m_surf);
	t+=dbg_decl("char_pixels",&m_char_pixels);
	t+=dbg_decl("pixel_ratio",&m_pixel_ratio);
	t+=dbg_decl("padding",&m_padding);
	t+=dbg_decl("char_rows",&m_char_rows);
	t+=dbg_decl("mask_color",&c_TText::m_mask_color);
	return t;
}
c_TTextureFilter::c_TTextureFilter(){
	m_text=String();
	m_flags=0;
}
c_List11* c_TTextureFilter::m_filter_list;
c_TTextureFilter* c_TTextureFilter::m_new(){
	DBG_ENTER("TTextureFilter.new")
	c_TTextureFilter *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/ttexture.monkey<790>");
	return this;
}
void c_TTextureFilter::mark(){
	Object::mark();
}
String c_TTextureFilter::debug(){
	String t="(TTextureFilter)\n";
	t+=dbg_decl("filter_list",&c_TTextureFilter::m_filter_list);
	t+=dbg_decl("text",&m_text);
	t+=dbg_decl("flags",&m_flags);
	return t;
}
c_List11::c_List11(){
	m__head=((new c_HeadNode11)->m_new());
}
c_List11* c_List11::m_new(){
	DBG_ENTER("List.new")
	c_List11 *self=this;
	DBG_LOCAL(self,"Self")
	return this;
}
c_Node13* c_List11::p_AddLast11(c_TTextureFilter* t_data){
	DBG_ENTER("List.AddLast")
	c_List11 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<108>");
	c_Node13* t_=(new c_Node13)->m_new(m__head,m__head->m__pred,t_data);
	return t_;
}
c_List11* c_List11::m_new2(Array<c_TTextureFilter* > t_data){
	DBG_ENTER("List.new")
	c_List11 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<13>");
	Array<c_TTextureFilter* > t_=t_data;
	int t_2=0;
	while(t_2<t_.Length()){
		DBG_BLOCK();
		c_TTextureFilter* t_t=t_.At(t_2);
		t_2=t_2+1;
		DBG_LOCAL(t_t,"t")
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<14>");
		p_AddLast11(t_t);
	}
	return this;
}
c_Enumerator11* c_List11::p_ObjectEnumerator(){
	DBG_ENTER("List.ObjectEnumerator")
	c_List11 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<186>");
	c_Enumerator11* t_=(new c_Enumerator11)->m_new(this);
	return t_;
}
void c_List11::mark(){
	Object::mark();
	gc_mark_q(m__head);
}
String c_List11::debug(){
	String t="(List)\n";
	t+=dbg_decl("_head",&m__head);
	return t;
}
c_Node13::c_Node13(){
	m__succ=0;
	m__pred=0;
	m__data=0;
}
c_Node13* c_Node13::m_new(c_Node13* t_succ,c_Node13* t_pred,c_TTextureFilter* t_data){
	DBG_ENTER("Node.new")
	c_Node13 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_succ,"succ")
	DBG_LOCAL(t_pred,"pred")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<261>");
	gc_assign(m__succ,t_succ);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<262>");
	gc_assign(m__pred,t_pred);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<263>");
	gc_assign(m__succ->m__pred,this);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<264>");
	gc_assign(m__pred->m__succ,this);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<265>");
	gc_assign(m__data,t_data);
	return this;
}
c_Node13* c_Node13::m_new2(){
	DBG_ENTER("Node.new")
	c_Node13 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<258>");
	return this;
}
void c_Node13::mark(){
	Object::mark();
	gc_mark_q(m__succ);
	gc_mark_q(m__pred);
	gc_mark_q(m__data);
}
String c_Node13::debug(){
	String t="(Node)\n";
	t+=dbg_decl("_succ",&m__succ);
	t+=dbg_decl("_pred",&m__pred);
	t+=dbg_decl("_data",&m__data);
	return t;
}
c_HeadNode11::c_HeadNode11(){
}
c_HeadNode11* c_HeadNode11::m_new(){
	DBG_ENTER("HeadNode.new")
	c_HeadNode11 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<310>");
	c_Node13::m_new2();
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<311>");
	gc_assign(m__succ,(this));
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<312>");
	gc_assign(m__pred,(this));
	return this;
}
void c_HeadNode11::mark(){
	c_Node13::mark();
}
String c_HeadNode11::debug(){
	String t="(HeadNode)\n";
	t=c_Node13::debug()+t;
	return t;
}
c_Enumerator11::c_Enumerator11(){
	m__list=0;
	m__curr=0;
}
c_Enumerator11* c_Enumerator11::m_new(c_List11* t_list){
	DBG_ENTER("Enumerator.new")
	c_Enumerator11 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_list,"list")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<326>");
	gc_assign(m__list,t_list);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<327>");
	gc_assign(m__curr,t_list->m__head->m__succ);
	return this;
}
c_Enumerator11* c_Enumerator11::m_new2(){
	DBG_ENTER("Enumerator.new")
	c_Enumerator11 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<323>");
	return this;
}
bool c_Enumerator11::p_HasNext(){
	DBG_ENTER("Enumerator.HasNext")
	c_Enumerator11 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<331>");
	while(m__curr->m__succ->m__pred!=m__curr){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<332>");
		gc_assign(m__curr,m__curr->m__succ);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<334>");
	bool t_=m__curr!=m__list->m__head;
	return t_;
}
c_TTextureFilter* c_Enumerator11::p_NextObject(){
	DBG_ENTER("Enumerator.NextObject")
	c_Enumerator11 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<338>");
	c_TTextureFilter* t_data=m__curr->m__data;
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<339>");
	gc_assign(m__curr,m__curr->m__succ);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<340>");
	return t_data;
}
void c_Enumerator11::mark(){
	Object::mark();
	gc_mark_q(m__list);
	gc_mark_q(m__curr);
}
String c_Enumerator11::debug(){
	String t="(Enumerator)\n";
	t+=dbg_decl("_list",&m__list);
	t+=dbg_decl("_curr",&m__curr);
	return t;
}
c_List12::c_List12(){
	m__head=((new c_HeadNode12)->m_new());
}
c_List12* c_List12::m_new(){
	DBG_ENTER("List.new")
	c_List12 *self=this;
	DBG_LOCAL(self,"Self")
	return this;
}
c_Node6* c_List12::p_AddLast12(c_TTexture* t_data){
	DBG_ENTER("List.AddLast")
	c_List12 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<108>");
	c_Node6* t_=(new c_Node6)->m_new(m__head,m__head->m__pred,t_data);
	return t_;
}
c_List12* c_List12::m_new2(Array<c_TTexture* > t_data){
	DBG_ENTER("List.new")
	c_List12 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<13>");
	Array<c_TTexture* > t_=t_data;
	int t_2=0;
	while(t_2<t_.Length()){
		DBG_BLOCK();
		c_TTexture* t_t=t_.At(t_2);
		t_2=t_2+1;
		DBG_LOCAL(t_t,"t")
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<14>");
		p_AddLast12(t_t);
	}
	return this;
}
c_Enumerator12* c_List12::p_ObjectEnumerator(){
	DBG_ENTER("List.ObjectEnumerator")
	c_List12 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<186>");
	c_Enumerator12* t_=(new c_Enumerator12)->m_new(this);
	return t_;
}
void c_List12::mark(){
	Object::mark();
	gc_mark_q(m__head);
}
String c_List12::debug(){
	String t="(List)\n";
	t+=dbg_decl("_head",&m__head);
	return t;
}
c_HeadNode12::c_HeadNode12(){
}
c_HeadNode12* c_HeadNode12::m_new(){
	DBG_ENTER("HeadNode.new")
	c_HeadNode12 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<310>");
	c_Node6::m_new2();
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<311>");
	gc_assign(m__succ,(this));
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<312>");
	gc_assign(m__pred,(this));
	return this;
}
void c_HeadNode12::mark(){
	c_Node6::mark();
}
String c_HeadNode12::debug(){
	String t="(HeadNode)\n";
	t=c_Node6::debug()+t;
	return t;
}
c_Enumerator12::c_Enumerator12(){
	m__list=0;
	m__curr=0;
}
c_Enumerator12* c_Enumerator12::m_new(c_List12* t_list){
	DBG_ENTER("Enumerator.new")
	c_Enumerator12 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_list,"list")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<326>");
	gc_assign(m__list,t_list);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<327>");
	gc_assign(m__curr,t_list->m__head->m__succ);
	return this;
}
c_Enumerator12* c_Enumerator12::m_new2(){
	DBG_ENTER("Enumerator.new")
	c_Enumerator12 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<323>");
	return this;
}
bool c_Enumerator12::p_HasNext(){
	DBG_ENTER("Enumerator.HasNext")
	c_Enumerator12 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<331>");
	while(m__curr->m__succ->m__pred!=m__curr){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<332>");
		gc_assign(m__curr,m__curr->m__succ);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<334>");
	bool t_=m__curr!=m__list->m__head;
	return t_;
}
c_TTexture* c_Enumerator12::p_NextObject(){
	DBG_ENTER("Enumerator.NextObject")
	c_Enumerator12 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<338>");
	c_TTexture* t_data=m__curr->m__data;
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<339>");
	gc_assign(m__curr,m__curr->m__succ);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<340>");
	return t_data;
}
void c_Enumerator12::mark(){
	Object::mark();
	gc_mark_q(m__list);
	gc_mark_q(m__curr);
}
String c_Enumerator12::debug(){
	String t="(Enumerator)\n";
	t+=dbg_decl("_list",&m__list);
	t+=dbg_decl("_curr",&m__curr);
	return t;
}
int bb_input_KeyHit(int t_key){
	DBG_ENTER("KeyHit")
	DBG_LOCAL(t_key,"key")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/input.monkey<44>");
	int t_=bb_input_device->p_KeyHit(t_key);
	return t_;
}
c_Enumerator13::c_Enumerator13(){
	m__list=0;
	m__curr=0;
}
c_Enumerator13* c_Enumerator13::m_new(c_List8* t_list){
	DBG_ENTER("Enumerator.new")
	c_Enumerator13 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_list,"list")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<326>");
	gc_assign(m__list,t_list);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<327>");
	gc_assign(m__curr,t_list->m__head->m__succ);
	return this;
}
c_Enumerator13* c_Enumerator13::m_new2(){
	DBG_ENTER("Enumerator.new")
	c_Enumerator13 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<323>");
	return this;
}
bool c_Enumerator13::p_HasNext(){
	DBG_ENTER("Enumerator.HasNext")
	c_Enumerator13 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<331>");
	while(m__curr->m__succ->m__pred!=m__curr){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<332>");
		gc_assign(m__curr,m__curr->m__succ);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<334>");
	bool t_=m__curr!=m__list->m__head;
	return t_;
}
c_CalLoadingCallback* c_Enumerator13::p_NextObject(){
	DBG_ENTER("Enumerator.NextObject")
	c_Enumerator13 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<338>");
	c_CalLoadingCallback* t_data=m__curr->m__data;
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<339>");
	gc_assign(m__curr,m__curr->m__succ);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<340>");
	return t_data;
}
void c_Enumerator13::mark(){
	Object::mark();
	gc_mark_q(m__list);
	gc_mark_q(m__curr);
}
String c_Enumerator13::debug(){
	String t="(Enumerator)\n";
	t+=dbg_decl("_list",&m__list);
	t+=dbg_decl("_curr",&m__curr);
	return t;
}
c_CalCoreBone::c_CalCoreBone(){
	m_m_name=String();
	m_m_coreSkeleton=0;
	m_m_rotationBoneSpace=0;
	m_m_boundingBox=0;
	m_m_boundingPosition=Array<c_CalVector* >();
	m_m_translation=0;
	m_m_boundingBoxPrecomputed=false;
	m_m_rotation=0;
	m_m_parentId=0;
	m_m_translationBoneSpace=0;
	m_m_listChildId=Array<int >();
	m_m_translationAbsolute=0;
	m_m_rotationAbsolute=0;
	m_m_userData=0;
}
void c_CalCoreBone::p_calculateBoundingBox(c_CalCoreModel* t_coreModel){
	DBG_ENTER("CalCoreBone.calculateBoundingBox")
	c_CalCoreBone *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_coreModel,"coreModel")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<152>");
	int t_boneId=m_m_coreSkeleton->p_getCoreBoneId(m_m_name);
	DBG_LOCAL(t_boneId,"boneId")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<153>");
	bool t_bBoundsComputed=false;
	DBG_LOCAL(t_bBoundsComputed,"bBoundsComputed")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<155>");
	c_CalQuaternion* t_rot=(new c_CalQuaternion)->m_new2(m_m_rotationBoneSpace);
	DBG_LOCAL(t_rot,"rot")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<156>");
	t_rot->p_invert();
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<158>");
	c_CalVector* t_dir=(new c_CalVector)->m_new3(FLOAT(1.0),FLOAT(0.0),FLOAT(0.0));
	DBG_LOCAL(t_dir,"dir")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<159>");
	t_dir->p_multQuaternionLocal(t_rot);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<160>");
	m_m_boundingBox->m_plane.At(0)->p_setNormal(t_dir);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<162>");
	t_dir->p_assign3(FLOAT(-1.0),FLOAT(0.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<163>");
	t_dir->p_multQuaternionLocal(t_rot);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<164>");
	m_m_boundingBox->m_plane.At(1)->p_setNormal(t_dir);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<166>");
	t_dir->p_assign3(FLOAT(0.0),FLOAT(1.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<167>");
	t_dir->p_multQuaternionLocal(t_rot);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<168>");
	m_m_boundingBox->m_plane.At(2)->p_setNormal(t_dir);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<170>");
	t_dir->p_assign3(FLOAT(0.0),FLOAT(-1.0),FLOAT(0.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<171>");
	t_dir->p_multQuaternionLocal(t_rot);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<172>");
	m_m_boundingBox->m_plane.At(3)->p_setNormal(t_dir);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<174>");
	t_dir->p_assign3(FLOAT(0.0),FLOAT(0.0),FLOAT(1.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<175>");
	t_dir->p_multQuaternionLocal(t_rot);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<176>");
	m_m_boundingBox->m_plane.At(4)->p_setNormal(t_dir);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<178>");
	t_dir->p_assign3(FLOAT(0.0),FLOAT(0.0),FLOAT(-1.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<179>");
	t_dir->p_multQuaternionLocal(t_rot);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<180>");
	m_m_boundingBox->m_plane.At(5)->p_setNormal(t_dir);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<182>");
	int t_coreMeshCount=t_coreModel->p_getCoreMeshCount();
	DBG_LOCAL(t_coreMeshCount,"coreMeshCount")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<183>");
	for(int t_meshId=0;t_meshId<=t_coreMeshCount-1;t_meshId=t_meshId+1){
		DBG_BLOCK();
		DBG_LOCAL(t_meshId,"meshId")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<184>");
		c_CalCoreMesh* t_coreMesh=t_coreModel->p_getCoreMesh(t_meshId);
		DBG_LOCAL(t_coreMesh,"coreMesh")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<186>");
		int t_coreSubmeshCount=t_coreMesh->p_getCoreSubmeshCount();
		DBG_LOCAL(t_coreSubmeshCount,"coreSubmeshCount")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<187>");
		for(int t_submeshId=0;t_submeshId<=t_coreSubmeshCount-1;t_submeshId=t_submeshId+1){
			DBG_BLOCK();
			DBG_LOCAL(t_submeshId,"submeshId")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<188>");
			c_CalCoreSubmesh* t_coreSubmesh=t_coreMesh->p_getCoreSubmesh(t_submeshId);
			DBG_LOCAL(t_coreSubmesh,"coreSubmesh")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<190>");
			if(t_coreSubmesh->p_getSpringCount()==0){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<191>");
				Array<c_CalVertex* > t_vectorVertex=t_coreSubmesh->p_getVectorVertex();
				DBG_LOCAL(t_vectorVertex,"vectorVertex")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<192>");
				for(int t_vertexId=0;t_vertexId<=t_vectorVertex.Length()-1;t_vertexId=t_vertexId+1){
					DBG_BLOCK();
					DBG_LOCAL(t_vertexId,"vertexId")
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<193>");
					int t_vertexInfluenceCount=t_vectorVertex.At(t_vertexId)->m_vectorInfluence.Length();
					DBG_LOCAL(t_vertexInfluenceCount,"vertexInfluenceCount")
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<194>");
					for(int t_influenceId=0;t_influenceId<=t_vertexInfluenceCount-1;t_influenceId=t_influenceId+1){
						DBG_BLOCK();
						DBG_LOCAL(t_influenceId,"influenceId")
						DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<195>");
						if(t_vectorVertex.At(t_vertexId)->m_vectorInfluence.At(t_influenceId)->m_boneId==t_boneId && t_vectorVertex.At(t_vertexId)->m_vectorInfluence.At(t_influenceId)->m_weight>FLOAT(0.5)){
							DBG_BLOCK();
							DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<196>");
							for(int t_planeId=0;t_planeId<=5;t_planeId=t_planeId+1){
								DBG_BLOCK();
								DBG_LOCAL(t_planeId,"planeId")
								DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<197>");
								if(m_m_boundingBox->m_plane.At(t_planeId)->p_eval(t_vectorVertex.At(t_vertexId)->m_position)<FLOAT(0.0)){
									DBG_BLOCK();
									DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<198>");
									m_m_boundingBox->m_plane.At(t_planeId)->p_setPosition(t_vectorVertex.At(t_vertexId)->m_position);
									DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<199>");
									m_m_boundingPosition.At(t_planeId)->p_assign4(t_vectorVertex.At(t_vertexId)->m_position);
									DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<200>");
									t_bBoundsComputed=true;
								}
							}
						}
					}
				}
			}
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<211>");
	if(t_bBoundsComputed==false){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<212>");
		for(int t_planeId2=0;t_planeId2<=5;t_planeId2=t_planeId2+1){
			DBG_BLOCK();
			DBG_LOCAL(t_planeId2,"planeId")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<213>");
			m_m_boundingBox->m_plane.At(t_planeId2)->p_setPosition(m_m_translation);
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<214>");
			m_m_boundingPosition.At(t_planeId2)->p_assign4(m_m_translation);
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<218>");
	m_m_boundingBoxPrecomputed=true;
}
c_CalVector* c_CalCoreBone::p_getTranslation(){
	DBG_ENTER("CalCoreBone.getTranslation")
	c_CalCoreBone *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<107>");
	return m_m_translation;
}
c_CalQuaternion* c_CalCoreBone::p_getRotation(){
	DBG_ENTER("CalCoreBone.getRotation")
	c_CalCoreBone *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<95>");
	return m_m_rotation;
}
int c_CalCoreBone::p_getParentId(){
	DBG_ENTER("CalCoreBone.getParentId")
	c_CalCoreBone *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<87>");
	return m_m_parentId;
}
c_CalVector* c_CalCoreBone::p_getTranslationBoneSpace(){
	DBG_ENTER("CalCoreBone.getTranslationBoneSpace")
	c_CalCoreBone *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<115>");
	return m_m_translationBoneSpace;
}
c_CalQuaternion* c_CalCoreBone::p_getRotationBoneSpace(){
	DBG_ENTER("CalCoreBone.getRotationBoneSpace")
	c_CalCoreBone *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<103>");
	return m_m_rotationBoneSpace;
}
Array<int > c_CalCoreBone::p_getListChildId(){
	DBG_ENTER("CalCoreBone.getListChildId")
	c_CalCoreBone *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<79>");
	return m_m_listChildId;
}
c_CalCoreBone* c_CalCoreBone::m_new(String t_name){
	DBG_ENTER("CalCoreBone.new")
	c_CalCoreBone *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_name,"name")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<23>");
	m_m_name=t_name;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<24>");
	m_m_coreSkeleton=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<25>");
	m_m_parentId=-1;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<26>");
	gc_assign(m_m_listChildId,Array<int >(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<27>");
	gc_assign(m_m_translation,(new c_CalVector)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<28>");
	gc_assign(m_m_rotation,(new c_CalQuaternion)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<29>");
	gc_assign(m_m_translationAbsolute,(new c_CalVector)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<30>");
	gc_assign(m_m_rotationAbsolute,(new c_CalQuaternion)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<31>");
	gc_assign(m_m_translationBoneSpace,(new c_CalVector)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<32>");
	gc_assign(m_m_rotationBoneSpace,(new c_CalQuaternion)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<33>");
	m_m_userData=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<34>");
	gc_assign(m_m_boundingBox,(new c_CalBoundingBox)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<35>");
	gc_assign(m_m_boundingPosition,Array<c_CalVector* >(6));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<36>");
	for(int t_i=0;t_i<=5;t_i=t_i+1){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<37>");
		gc_assign(m_m_boundingPosition.At(t_i),(new c_CalVector)->m_new());
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<39>");
	m_m_boundingBoxPrecomputed=false;
	return this;
}
void c_CalCoreBone::p_setParentId(int t_parentId){
	DBG_ENTER("CalCoreBone.setParentId")
	c_CalCoreBone *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_parentId,"parentId")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<127>");
	m_m_parentId=t_parentId;
}
void c_CalCoreBone::p_setTranslation(c_CalVector* t_translation){
	DBG_ENTER("CalCoreBone.setTranslation")
	c_CalCoreBone *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_translation,"translation")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<139>");
	m_m_translation->p_assign4(t_translation);
}
void c_CalCoreBone::p_setRotation(c_CalQuaternion* t_rotation){
	DBG_ENTER("CalCoreBone.setRotation")
	c_CalCoreBone *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_rotation,"rotation")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<131>");
	m_m_rotation->p_assign(t_rotation);
}
void c_CalCoreBone::p_setTranslationBoneSpace(c_CalVector* t_translation){
	DBG_ENTER("CalCoreBone.setTranslationBoneSpace")
	c_CalCoreBone *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_translation,"translation")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<143>");
	m_m_translationBoneSpace->p_assign4(t_translation);
}
void c_CalCoreBone::p_setRotationBoneSpace(c_CalQuaternion* t_rotation){
	DBG_ENTER("CalCoreBone.setRotationBoneSpace")
	c_CalCoreBone *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_rotation,"rotation")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<135>");
	m_m_rotationBoneSpace->p_assign(t_rotation);
}
bool c_CalCoreBone::p_addChildId(int t_childId){
	DBG_ENTER("CalCoreBone.addChildId")
	c_CalCoreBone *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_childId,"childId")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<44>");
	int t_id=m_m_listChildId.Length();
	DBG_LOCAL(t_id,"id")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<46>");
	gc_assign(m_m_listChildId,m_m_listChildId.Resize(m_m_listChildId.Length()+1));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<47>");
	m_m_listChildId.At(t_id)=t_childId;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<48>");
	return true;
}
void c_CalCoreBone::p_setCoreSkeleton(c_CalCoreSkeleton* t_coreSkeleton){
	DBG_ENTER("CalCoreBone.setCoreSkeleton")
	c_CalCoreBone *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_coreSkeleton,"coreSkeleton")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<123>");
	gc_assign(m_m_coreSkeleton,t_coreSkeleton);
}
String c_CalCoreBone::p_getName(){
	DBG_ENTER("CalCoreBone.getName")
	c_CalCoreBone *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<83>");
	return m_m_name;
}
c_CalQuaternion* c_CalCoreBone::p_getRotationAbsolute(){
	DBG_ENTER("CalCoreBone.getRotationAbsolute")
	c_CalCoreBone *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<99>");
	return m_m_rotationAbsolute;
}
c_CalVector* c_CalCoreBone::p_getTranslationAbsolute(){
	DBG_ENTER("CalCoreBone.getTranslationAbsolute")
	c_CalCoreBone *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<111>");
	return m_m_translationAbsolute;
}
void c_CalCoreBone::p_calculateState(){
	DBG_ENTER("CalCoreBone.calculateState")
	c_CalCoreBone *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<53>");
	if(m_m_parentId==-1){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<55>");
		m_m_translationAbsolute->p_assign4(m_m_translation);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<56>");
		m_m_rotationAbsolute->p_assign(m_m_rotation);
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<60>");
		c_CalCoreBone* t_parent=m_m_coreSkeleton->p_getCoreBone(m_m_parentId);
		DBG_LOCAL(t_parent,"parent")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<63>");
		m_m_translationAbsolute->p_assign4(m_m_translation);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<64>");
		m_m_translationAbsolute->p_multQuaternionLocal(t_parent->p_getRotationAbsolute());
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<65>");
		m_m_translationAbsolute->p_addLocal(t_parent->p_getTranslationAbsolute());
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<67>");
		m_m_rotationAbsolute->p_assign(m_m_rotation);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<68>");
		m_m_rotationAbsolute->p_multQuaternionLocal(t_parent->p_getRotationAbsolute());
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<72>");
	for(int t_iChildId=0;t_iChildId<=m_m_listChildId.Length()-1;t_iChildId=t_iChildId+1){
		DBG_BLOCK();
		DBG_LOCAL(t_iChildId,"iChildId")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corebone.monkey<73>");
		m_m_coreSkeleton->p_getCoreBone(m_m_listChildId.At(t_iChildId))->p_calculateState();
	}
}
void c_CalCoreBone::mark(){
	Object::mark();
	gc_mark_q(m_m_coreSkeleton);
	gc_mark_q(m_m_rotationBoneSpace);
	gc_mark_q(m_m_boundingBox);
	gc_mark_q(m_m_boundingPosition);
	gc_mark_q(m_m_translation);
	gc_mark_q(m_m_rotation);
	gc_mark_q(m_m_translationBoneSpace);
	gc_mark_q(m_m_listChildId);
	gc_mark_q(m_m_translationAbsolute);
	gc_mark_q(m_m_rotationAbsolute);
	gc_mark_q(m_m_userData);
}
String c_CalCoreBone::debug(){
	String t="(CalCoreBone)\n";
	t+=dbg_decl("m_name",&m_m_name);
	t+=dbg_decl("m_coreSkeleton",&m_m_coreSkeleton);
	t+=dbg_decl("m_parentId",&m_m_parentId);
	t+=dbg_decl("m_listChildId",&m_m_listChildId);
	t+=dbg_decl("m_translation",&m_m_translation);
	t+=dbg_decl("m_rotation",&m_m_rotation);
	t+=dbg_decl("m_translationAbsolute",&m_m_translationAbsolute);
	t+=dbg_decl("m_rotationAbsolute",&m_m_rotationAbsolute);
	t+=dbg_decl("m_translationBoneSpace",&m_m_translationBoneSpace);
	t+=dbg_decl("m_rotationBoneSpace",&m_m_rotationBoneSpace);
	t+=dbg_decl("m_userData",&m_m_userData);
	t+=dbg_decl("m_boundingBox",&m_m_boundingBox);
	t+=dbg_decl("m_boundingPosition",&m_m_boundingPosition);
	t+=dbg_decl("m_boundingBoxPrecomputed",&m_m_boundingBoxPrecomputed);
	return t;
}
c_Node14::c_Node14(){
	m_key=String();
	m_right=0;
	m_left=0;
	m_value=0;
	m_color=0;
	m_parent=0;
}
c_Node14* c_Node14::m_new(String t_key,int t_value,int t_color,c_Node14* t_parent){
	DBG_ENTER("Node.new")
	c_Node14 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_key,"key")
	DBG_LOCAL(t_value,"value")
	DBG_LOCAL(t_color,"color")
	DBG_LOCAL(t_parent,"parent")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<364>");
	this->m_key=t_key;
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<365>");
	this->m_value=t_value;
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<366>");
	this->m_color=t_color;
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<367>");
	gc_assign(this->m_parent,t_parent);
	return this;
}
c_Node14* c_Node14::m_new2(){
	DBG_ENTER("Node.new")
	c_Node14 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<361>");
	return this;
}
void c_Node14::mark(){
	Object::mark();
	gc_mark_q(m_right);
	gc_mark_q(m_left);
	gc_mark_q(m_parent);
}
String c_Node14::debug(){
	String t="(Node)\n";
	t+=dbg_decl("key",&m_key);
	t+=dbg_decl("value",&m_value);
	t+=dbg_decl("color",&m_color);
	t+=dbg_decl("parent",&m_parent);
	t+=dbg_decl("left",&m_left);
	t+=dbg_decl("right",&m_right);
	return t;
}
c_CalQuaternion::c_CalQuaternion(){
	m_x=FLOAT(.0);
	m_y=FLOAT(.0);
	m_z=FLOAT(.0);
	m_w=FLOAT(.0);
}
c_CalQuaternion* c_CalQuaternion::m_new(){
	DBG_ENTER("CalQuaternion.new")
	c_CalQuaternion *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<135>");
	m_x=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<136>");
	m_y=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<137>");
	m_z=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<138>");
	m_w=FLOAT(1.0);
	return this;
}
c_CalQuaternion* c_CalQuaternion::m_new2(c_CalQuaternion* t_other){
	DBG_ENTER("CalQuaternion.new")
	c_CalQuaternion *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_other,"other")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<142>");
	m_x=t_other->m_x;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<143>");
	m_y=t_other->m_y;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<144>");
	m_z=t_other->m_z;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<145>");
	m_w=t_other->m_w;
	return this;
}
c_CalQuaternion* c_CalQuaternion::m_new3(Float t_xx,Float t_yy,Float t_zz,Float t_ww){
	DBG_ENTER("CalQuaternion.new")
	c_CalQuaternion *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_xx,"xx")
	DBG_LOCAL(t_yy,"yy")
	DBG_LOCAL(t_zz,"zz")
	DBG_LOCAL(t_ww,"ww")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<149>");
	m_x=t_xx;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<150>");
	m_y=t_yy;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<151>");
	m_z=t_zz;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<152>");
	m_w=t_ww;
	return this;
}
void c_CalQuaternion::p_conjugate(){
	DBG_ENTER("CalQuaternion.conjugate")
	c_CalQuaternion *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<247>");
	m_x=-m_x;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<248>");
	m_y=-m_y;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<249>");
	m_z=-m_z;
}
void c_CalQuaternion::p_invert(){
	DBG_ENTER("CalQuaternion.invert")
	c_CalQuaternion *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<253>");
	p_conjugate();
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<255>");
	Float t_norm=m_x*m_x+m_y*m_y+m_z*m_z+m_w*m_w;
	DBG_LOCAL(t_norm,"norm")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<257>");
	if(t_norm==FLOAT(0.0)){
		DBG_BLOCK();
		return;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<261>");
	Float t_inv_norm=FLOAT(1.0)/t_norm;
	DBG_LOCAL(t_inv_norm,"inv_norm")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<262>");
	m_x*=t_inv_norm;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<263>");
	m_y*=t_inv_norm;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<264>");
	m_z*=t_inv_norm;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<265>");
	m_w*=t_inv_norm;
}
c_CalQuaternion* c_CalQuaternion::p_multVectorLocal(c_CalVector* t_v){
	DBG_ENTER("CalQuaternion.multVectorLocal")
	c_CalQuaternion *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_v,"v")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<180>");
	Float t_qx=m_x;
	DBG_LOCAL(t_qx,"qx")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<181>");
	Float t_qy=m_y;
	DBG_LOCAL(t_qy,"qy")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<182>");
	Float t_qz=m_z;
	DBG_LOCAL(t_qz,"qz")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<183>");
	Float t_qw=m_w;
	DBG_LOCAL(t_qw,"qw")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<185>");
	m_x=t_qw*t_v->m_x+t_qy*t_v->m_z-t_qz*t_v->m_y;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<186>");
	m_y=t_qw*t_v->m_y-t_qx*t_v->m_z+t_qz*t_v->m_x;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<187>");
	m_z=t_qw*t_v->m_z+t_qx*t_v->m_y-t_qy*t_v->m_x;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<188>");
	m_w=-t_qx*t_v->m_x-t_qy*t_v->m_y-t_qz*t_v->m_z;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<190>");
	return this;
}
c_CalQuaternion* c_CalQuaternion::p_multQuaternionLocal(c_CalQuaternion* t_q){
	DBG_ENTER("CalQuaternion.multQuaternionLocal")
	c_CalQuaternion *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_q,"q")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<165>");
	Float t_qx=m_x;
	DBG_LOCAL(t_qx,"qx")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<166>");
	Float t_qy=m_y;
	DBG_LOCAL(t_qy,"qy")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<167>");
	Float t_qz=m_z;
	DBG_LOCAL(t_qz,"qz")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<168>");
	Float t_qw=m_w;
	DBG_LOCAL(t_qw,"qw")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<170>");
	m_x=t_qw*t_q->m_x+t_qx*t_q->m_w+t_qy*t_q->m_z-t_qz*t_q->m_y;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<171>");
	m_y=t_qw*t_q->m_y-t_qx*t_q->m_z+t_qy*t_q->m_w+t_qz*t_q->m_x;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<172>");
	m_z=t_qw*t_q->m_z+t_qx*t_q->m_y-t_qy*t_q->m_x+t_qz*t_q->m_w;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<173>");
	m_w=t_qw*t_q->m_w-t_qx*t_q->m_x-t_qy*t_q->m_y-t_qz*t_q->m_z;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<175>");
	return this;
}
void c_CalQuaternion::p_assign(c_CalQuaternion* t_other){
	DBG_ENTER("CalQuaternion.assign")
	c_CalQuaternion *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_other,"other")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<157>");
	m_x=t_other->m_x;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<158>");
	m_y=t_other->m_y;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<159>");
	m_z=t_other->m_z;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<160>");
	m_w=t_other->m_w;
}
void c_CalQuaternion::p_blend(Float t_d,c_CalQuaternion* t_q){
	DBG_ENTER("CalQuaternion.blend")
	c_CalQuaternion *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_d,"d")
	DBG_LOCAL(t_q,"q")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<203>");
	Float t_norm=m_x*t_q->m_x+m_y*t_q->m_y+m_z*t_q->m_z+m_w*t_q->m_w;
	DBG_LOCAL(t_norm,"norm")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<205>");
	bool t_bFlip=false;
	DBG_LOCAL(t_bFlip,"bFlip")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<206>");
	if(t_norm<FLOAT(0.0)){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<208>");
		t_norm=-t_norm;
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<209>");
		t_bFlip=true;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<212>");
	Float t_inv_d=FLOAT(.0);
	DBG_LOCAL(t_inv_d,"inv_d")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<213>");
	if(FLOAT(1.0)-t_norm<FLOAT(1e-6)){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<215>");
		t_inv_d=FLOAT(1.0)-t_d;
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<219>");
		Float t_theta=(Float)(acos(t_norm)*R2D);
		DBG_LOCAL(t_theta,"theta")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<220>");
		Float t_s=FLOAT(1.0)/(Float)sin((t_theta)*D2R);
		DBG_LOCAL(t_s,"s")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<222>");
		t_inv_d=(Float)sin(((FLOAT(1.0)-t_d)*t_theta)*D2R)*t_s;
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<223>");
		t_d=(Float)sin((t_d*t_theta)*D2R)*t_s;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<226>");
	if(t_bFlip){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<228>");
		t_d=-t_d;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<231>");
	m_x=t_inv_d*m_x+t_d*t_q->m_x;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<232>");
	m_y=t_inv_d*m_y+t_d*t_q->m_y;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<233>");
	m_z=t_inv_d*m_z+t_d*t_q->m_z;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<234>");
	m_w=t_inv_d*m_w+t_d*t_q->m_w;
}
void c_CalQuaternion::mark(){
	Object::mark();
}
String c_CalQuaternion::debug(){
	String t="(CalQuaternion)\n";
	t+=dbg_decl("x",&m_x);
	t+=dbg_decl("y",&m_y);
	t+=dbg_decl("z",&m_z);
	t+=dbg_decl("w",&m_w);
	return t;
}
c_CalVector::c_CalVector(){
	m_x=FLOAT(.0);
	m_y=FLOAT(.0);
	m_z=FLOAT(.0);
}
c_CalVector* c_CalVector::m_new(){
	DBG_ENTER("CalVector.new")
	c_CalVector *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<301>");
	m_x=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<302>");
	m_y=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<303>");
	m_z=FLOAT(0.0);
	return this;
}
c_CalVector* c_CalVector::m_new2(c_CalVector* t_other){
	DBG_ENTER("CalVector.new")
	c_CalVector *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_other,"other")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<308>");
	m_x=t_other->m_x;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<309>");
	m_y=t_other->m_y;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<310>");
	m_z=t_other->m_z;
	return this;
}
c_CalVector* c_CalVector::m_new3(Float t_xx,Float t_yy,Float t_zz){
	DBG_ENTER("CalVector.new")
	c_CalVector *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_xx,"xx")
	DBG_LOCAL(t_yy,"yy")
	DBG_LOCAL(t_zz,"zz")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<315>");
	m_x=t_xx;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<316>");
	m_y=t_yy;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<317>");
	m_z=t_zz;
	return this;
}
c_CalVector* c_CalVector::p_multQuaternionLocal(c_CalQuaternion* t_q){
	DBG_ENTER("CalVector.multQuaternionLocal")
	c_CalVector *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_q,"q")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<381>");
	c_CalQuaternion* t_temp=(new c_CalQuaternion)->m_new3(-t_q->m_x,-t_q->m_y,-t_q->m_z,t_q->m_w);
	DBG_LOCAL(t_temp,"temp")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<382>");
	t_temp->p_multVectorLocal(this)->p_multQuaternionLocal(t_q);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<384>");
	m_x=t_temp->m_x;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<385>");
	m_y=t_temp->m_y;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<386>");
	m_z=t_temp->m_z;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<388>");
	return this;
}
void c_CalVector::p_assign2(c_CalVertex* t_v){
	DBG_ENTER("CalVector.assign")
	c_CalVector *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_v,"v")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<324>");
	m_x=t_v->m_position->m_x;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<325>");
	m_y=t_v->m_position->m_y;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<326>");
	m_z=t_v->m_position->m_z;
}
void c_CalVector::p_assign3(Float t_xx,Float t_yy,Float t_zz){
	DBG_ENTER("CalVector.assign")
	c_CalVector *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_xx,"xx")
	DBG_LOCAL(t_yy,"yy")
	DBG_LOCAL(t_zz,"zz")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<333>");
	m_x=t_xx;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<334>");
	m_y=t_yy;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<335>");
	m_z=t_zz;
}
void c_CalVector::p_assign4(c_CalVector* t_v){
	DBG_ENTER("CalVector.assign")
	c_CalVector *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_v,"v")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<341>");
	m_x=t_v->m_x;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<342>");
	m_y=t_v->m_y;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<343>");
	m_z=t_v->m_z;
}
c_CalVector* c_CalVector::p_multMatrixLocal(c_CalMatrix* t_m){
	DBG_ENTER("CalVector.multMatrixLocal")
	c_CalVector *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_m,"m")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<393>");
	Float t_ox=m_x;
	DBG_LOCAL(t_ox,"ox")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<394>");
	Float t_oy=m_y;
	DBG_LOCAL(t_oy,"oy")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<395>");
	Float t_oz=m_z;
	DBG_LOCAL(t_oz,"oz")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<396>");
	m_x=t_m->m_dxdx*t_ox+t_m->m_dxdy*t_oy+t_m->m_dxdz*t_oz;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<397>");
	m_y=t_m->m_dydx*t_ox+t_m->m_dydy*t_oy+t_m->m_dydz*t_oz;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<398>");
	m_z=t_m->m_dzdx*t_ox+t_m->m_dzdy*t_oy+t_m->m_dzdz*t_oz;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<400>");
	return this;
}
c_CalVector* c_CalVector::p_addLocal(c_CalVector* t_v){
	DBG_ENTER("CalVector.addLocal")
	c_CalVector *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_v,"v")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<350>");
	m_x+=t_v->m_x;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<351>");
	m_y+=t_v->m_y;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<352>");
	m_z+=t_v->m_z;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<354>");
	return this;
}
void c_CalVector::p_blend2(Float t_d,c_CalVector* t_v){
	DBG_ENTER("CalVector.blend")
	c_CalVector *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_d,"d")
	DBG_LOCAL(t_v,"v")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<405>");
	m_x+=t_d*(t_v->m_x-m_x);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<406>");
	m_y+=t_d*(t_v->m_y-m_y);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<407>");
	m_z+=t_d*(t_v->m_z-m_z);
}
c_CalVector* c_CalVector::p_multScalarLocal(Float t_factor){
	DBG_ENTER("CalVector.multScalarLocal")
	c_CalVector *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_factor,"factor")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<370>");
	m_x*=t_factor;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<371>");
	m_y*=t_factor;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<372>");
	m_z*=t_factor;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<374>");
	return this;
}
Float c_CalVector::p_normalize(){
	DBG_ENTER("CalVector.normalize")
	c_CalVector *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<445>");
	Float t_len=(Float)sqrt(m_x*m_x+m_y*m_y+m_z*m_z);
	DBG_LOCAL(t_len,"len")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<446>");
	m_x/=t_len;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<447>");
	m_y/=t_len;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<448>");
	m_z/=t_len;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<450>");
	return t_len;
}
c_CalVector* c_CalVector::p_subLocal(c_CalVector* t_v){
	DBG_ENTER("CalVector.subLocal")
	c_CalVector *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_v,"v")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<360>");
	m_x-=t_v->m_x;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<361>");
	m_y-=t_v->m_y;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<362>");
	m_z-=t_v->m_z;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<364>");
	return this;
}
void c_CalVector::p_clear(){
	DBG_ENTER("CalVector.clear")
	c_CalVector *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<432>");
	m_x=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<433>");
	m_y=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<434>");
	m_z=FLOAT(0.0);
}
Float c_CalVector::p_length(){
	DBG_ENTER("CalVector.length")
	c_CalVector *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<439>");
	Float t_=(Float)sqrt(m_x*m_x+m_y*m_y+m_z*m_z);
	return t_;
}
void c_CalVector::mark(){
	Object::mark();
}
String c_CalVector::debug(){
	String t="(CalVector)\n";
	t+=dbg_decl("x",&m_x);
	t+=dbg_decl("y",&m_y);
	t+=dbg_decl("z",&m_z);
	return t;
}
c_CalBoundingBox::c_CalBoundingBox(){
	m_plane=Array<c_CalPlane* >();
}
c_CalBoundingBox* c_CalBoundingBox::m_new(){
	DBG_ENTER("CalBoundingBox.new")
	c_CalBoundingBox *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bounding.monkey<54>");
	gc_assign(m_plane,Array<c_CalPlane* >(6));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bounding.monkey<55>");
	for(int t_i=0;t_i<=5;t_i=t_i+1){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bounding.monkey<57>");
		gc_assign(m_plane.At(t_i),(new c_CalPlane)->m_new());
	}
	return this;
}
void c_CalBoundingBox::mark(){
	Object::mark();
	gc_mark_q(m_plane);
}
String c_CalBoundingBox::debug(){
	String t="(CalBoundingBox)\n";
	t+=dbg_decl("plane",&m_plane);
	return t;
}
c_CalPlane::c_CalPlane(){
	m_a=FLOAT(.0);
	m_b=FLOAT(.0);
	m_c=FLOAT(.0);
	m_d=FLOAT(.0);
}
void c_CalPlane::p_setNormal(c_CalVector* t_n){
	DBG_ENTER("CalPlane.setNormal")
	c_CalPlane *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_n,"n")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bounding.monkey<31>");
	m_a=t_n->m_x;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bounding.monkey<32>");
	m_b=t_n->m_y;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bounding.monkey<33>");
	m_c=t_n->m_z;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bounding.monkey<34>");
	m_d=FLOAT(-1e32);
}
Float c_CalPlane::p_eval(c_CalVector* t_p){
	DBG_ENTER("CalPlane.eval")
	c_CalPlane *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_p,"p")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bounding.monkey<19>");
	Float t_=t_p->m_x*m_a+t_p->m_y*m_b+t_p->m_z*m_c+m_d;
	return t_;
}
void c_CalPlane::p_setPosition(c_CalVector* t_p){
	DBG_ENTER("CalPlane.setPosition")
	c_CalPlane *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_p,"p")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bounding.monkey<25>");
	m_d=-t_p->m_x*m_a-t_p->m_y*m_b-t_p->m_z*m_c;
}
c_CalPlane* c_CalPlane::m_new(){
	DBG_ENTER("CalPlane.new")
	c_CalPlane *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bounding.monkey<9>");
	m_a=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bounding.monkey<10>");
	m_b=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bounding.monkey<11>");
	m_c=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bounding.monkey<12>");
	m_d=FLOAT(0.0);
	return this;
}
Float c_CalPlane::p_dist(c_CalVector* t_p){
	DBG_ENTER("CalPlane.dist")
	c_CalPlane *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_p,"p")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bounding.monkey<41>");
	Float t_=bb_math2_Abs2((t_p->m_x*m_a+t_p->m_y*m_b+t_p->m_z*m_c+m_d)/(Float)sqrt(m_a*m_a+m_b*m_b+m_c*m_c));
	return t_;
}
void c_CalPlane::mark(){
	Object::mark();
}
String c_CalPlane::debug(){
	String t="(CalPlane)\n";
	t+=dbg_decl("a",&m_a);
	t+=dbg_decl("b",&m_b);
	t+=dbg_decl("c",&m_c);
	t+=dbg_decl("d",&m_d);
	return t;
}
c_CalVertex::c_CalVertex(){
	m_position=0;
	m_vectorInfluence=Array<c_CalInfluence* >();
	m_faceCollapseCount=0;
	m_collapseId=0;
	m_normal=0;
}
c_CalVertex* c_CalVertex::m_new(){
	DBG_ENTER("CalVertex.new")
	c_CalVertex *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<446>");
	gc_assign(m_position,(new c_CalVector)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<447>");
	gc_assign(m_normal,(new c_CalVector)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<448>");
	gc_assign(m_vectorInfluence,Array<c_CalInfluence* >(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<449>");
	m_collapseId=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<450>");
	m_faceCollapseCount=0;
	return this;
}
c_CalVertex* c_CalVertex::m_new2(c_CalVector* t_p){
	DBG_ENTER("CalVertex.new")
	c_CalVertex *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_p,"p")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<456>");
	gc_assign(m_position,(new c_CalVector)->m_new2(t_p));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<457>");
	gc_assign(m_normal,(new c_CalVector)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<458>");
	gc_assign(m_vectorInfluence,Array<c_CalInfluence* >(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<459>");
	m_collapseId=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<460>");
	m_faceCollapseCount=0;
	return this;
}
c_CalVertex* c_CalVertex::m_new3(c_CalVector* t_p,c_CalVector* t_n){
	DBG_ENTER("CalVertex.new")
	c_CalVertex *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_p,"p")
	DBG_LOCAL(t_n,"n")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<466>");
	gc_assign(m_position,(new c_CalVector)->m_new2(t_p));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<467>");
	gc_assign(m_normal,(new c_CalVector)->m_new2(t_n));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<468>");
	gc_assign(m_vectorInfluence,Array<c_CalInfluence* >(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<469>");
	m_collapseId=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<470>");
	m_faceCollapseCount=0;
	return this;
}
c_CalVertex* c_CalVertex::m_new4(c_CalVector* t_p,c_CalVector* t_n,Array<c_CalInfluence* > t_i,int t_c,int t_fcc){
	DBG_ENTER("CalVertex.new")
	c_CalVertex *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_p,"p")
	DBG_LOCAL(t_n,"n")
	DBG_LOCAL(t_i,"i")
	DBG_LOCAL(t_c,"c")
	DBG_LOCAL(t_fcc,"fcc")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<476>");
	gc_assign(m_position,(new c_CalVector)->m_new2(t_p));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<477>");
	gc_assign(m_normal,(new c_CalVector)->m_new2(t_n));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<478>");
	gc_assign(m_vectorInfluence,t_i.Resize(t_i.Length()));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<479>");
	m_collapseId=t_c;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<480>");
	m_faceCollapseCount=t_fcc;
	return this;
}
void c_CalVertex::mark(){
	Object::mark();
	gc_mark_q(m_position);
	gc_mark_q(m_vectorInfluence);
	gc_mark_q(m_normal);
}
String c_CalVertex::debug(){
	String t="(CalVertex)\n";
	t+=dbg_decl("position",&m_position);
	t+=dbg_decl("normal",&m_normal);
	t+=dbg_decl("vectorInfluence",&m_vectorInfluence);
	t+=dbg_decl("collapseId",&m_collapseId);
	t+=dbg_decl("faceCollapseCount",&m_faceCollapseCount);
	return t;
}
c_CalCoreSubmesh::c_CalCoreSubmesh(){
	m_m_vectorSpring=Array<c_CalSpring* >();
	m_m_vectorVertex=Array<c_CalVertex* >();
	m_m_vectorCoreSubMorphTarget=Array<c_CalCoreSubMorphTarget* >();
	m_m_vectorFace=Array<c_CalFace* >();
	m_m_lodCount=0;
	m_m_vectorvectorTangentSpace=Array<Array<c_CalTangentSpace* > >();
	m_m_vectorPhysicalProperty=Array<c_CalPhysicalProperty* >();
	m_m_vectorTangentsEnabled=Array<bool >();
	m_m_vectorvectorTextureCoordinate=Array<Array<c_CalTextureCoordinate* > >();
	m_m_coreMaterialThreadId=0;
}
int c_CalCoreSubmesh::p_getSpringCount(){
	DBG_ENTER("CalCoreSubmesh.getSpringCount")
	c_CalCoreSubmesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<31>");
	int t_=m_m_vectorSpring.Length();
	return t_;
}
Array<c_CalVertex* > c_CalCoreSubmesh::p_getVectorVertex(){
	DBG_ENTER("CalCoreSubmesh.getVectorVertex")
	c_CalCoreSubmesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<57>");
	return m_m_vectorVertex;
}
int c_CalCoreSubmesh::p_getCoreSubMorphTargetCount(){
	DBG_ENTER("CalCoreSubmesh.getCoreSubMorphTargetCount")
	c_CalCoreSubmesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<259>");
	int t_=m_m_vectorCoreSubMorphTarget.Length();
	return t_;
}
int c_CalCoreSubmesh::p_getFaceCount(){
	DBG_ENTER("CalCoreSubmesh.getFaceCount")
	c_CalCoreSubmesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<23>");
	int t_=m_m_vectorFace.Length();
	return t_;
}
int c_CalCoreSubmesh::p_getLodCount(){
	DBG_ENTER("CalCoreSubmesh.getLodCount")
	c_CalCoreSubmesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<27>");
	return m_m_lodCount;
}
int c_CalCoreSubmesh::p_getVertexCount(){
	DBG_ENTER("CalCoreSubmesh.getVertexCount")
	c_CalCoreSubmesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<61>");
	int t_=m_m_vectorVertex.Length();
	return t_;
}
Array<c_CalFace* > c_CalCoreSubmesh::p_getVectorFace(){
	DBG_ENTER("CalCoreSubmesh.getVectorFace")
	c_CalCoreSubmesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<35>");
	return m_m_vectorFace;
}
Array<Array<c_CalTangentSpace* > > c_CalCoreSubmesh::p_getVectorVectorTangentSpace(){
	DBG_ENTER("CalCoreSubmesh.getVectorVectorTangentSpace")
	c_CalCoreSubmesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<48>");
	return m_m_vectorvectorTangentSpace;
}
Array<c_CalPhysicalProperty* > c_CalCoreSubmesh::p_getVectorPhysicalProperty(){
	DBG_ENTER("CalCoreSubmesh.getVectorPhysicalProperty")
	c_CalCoreSubmesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<39>");
	return m_m_vectorPhysicalProperty;
}
Array<c_CalCoreSubMorphTarget* > c_CalCoreSubmesh::p_getVectorCoreSubMorphTarget(){
	DBG_ENTER("CalCoreSubmesh.getVectorCoreSubMorphTarget")
	c_CalCoreSubmesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<266>");
	return m_m_vectorCoreSubMorphTarget;
}
bool c_CalCoreSubmesh::p_isTangentsEnabled(int t_mapId){
	DBG_ENTER("CalCoreSubmesh.isTangentsEnabled")
	c_CalCoreSubmesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_mapId,"mapId")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<66>");
	if(t_mapId<0 || t_mapId>=m_m_vectorTangentsEnabled.Length()){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<67>");
		return false;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<70>");
	return m_m_vectorTangentsEnabled.At(t_mapId);
}
Array<c_CalSpring* > c_CalCoreSubmesh::p_getVectorSpring(){
	DBG_ENTER("CalCoreSubmesh.getVectorSpring")
	c_CalCoreSubmesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<43>");
	return m_m_vectorSpring;
}
Array<Array<c_CalTextureCoordinate* > > c_CalCoreSubmesh::p_getVectorVectorTextureCoordinate(){
	DBG_ENTER("CalCoreSubmesh.getVectorVectorTextureCoordinate")
	c_CalCoreSubmesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<53>");
	return m_m_vectorvectorTextureCoordinate;
}
c_CalCoreSubmesh* c_CalCoreSubmesh::m_new(){
	DBG_ENTER("CalCoreSubmesh.new")
	c_CalCoreSubmesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<3>");
	return this;
}
void c_CalCoreSubmesh::p_setLodCount(int t_lodCount){
	DBG_ENTER("CalCoreSubmesh.setLodCount")
	c_CalCoreSubmesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_lodCount,"lodCount")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<154>");
	m_m_lodCount=t_lodCount;
}
void c_CalCoreSubmesh::p_setCoreMaterialThreadId(int t_coreMaterialThreadId){
	DBG_ENTER("CalCoreSubmesh.setCoreMaterialThreadId")
	c_CalCoreSubmesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_coreMaterialThreadId,"coreMaterialThreadId")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<139>");
	m_m_coreMaterialThreadId=t_coreMaterialThreadId;
}
bool c_CalCoreSubmesh::p_reserve(int t_vertexCount,int t_textureCoordinateCount,int t_faceCount,int t_springCount){
	DBG_ENTER("CalCoreSubmesh.reserve")
	c_CalCoreSubmesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_vertexCount,"vertexCount")
	DBG_LOCAL(t_textureCoordinateCount,"textureCoordinateCount")
	DBG_LOCAL(t_faceCount,"faceCount")
	DBG_LOCAL(t_springCount,"springCount")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<109>");
	gc_assign(m_m_vectorVertex,Array<c_CalVertex* >(t_vertexCount));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<110>");
	gc_assign(m_m_vectorTangentsEnabled,Array<bool >(t_textureCoordinateCount));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<111>");
	gc_assign(m_m_vectorvectorTangentSpace,Array<Array<c_CalTangentSpace* > >(t_textureCoordinateCount));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<112>");
	gc_assign(m_m_vectorvectorTextureCoordinate,Array<Array<c_CalTextureCoordinate* > >(t_textureCoordinateCount));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<115>");
	for(int t_textureCoordinateId=0;t_textureCoordinateId<=t_textureCoordinateCount-1;t_textureCoordinateId=t_textureCoordinateId+1){
		DBG_BLOCK();
		DBG_LOCAL(t_textureCoordinateId,"textureCoordinateId")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<116>");
		gc_assign(m_m_vectorvectorTextureCoordinate.At(t_textureCoordinateId),Array<c_CalTextureCoordinate* >(t_vertexCount));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<118>");
		if(m_m_vectorTangentsEnabled.At(t_textureCoordinateId)==true){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<119>");
			gc_assign(m_m_vectorvectorTangentSpace.At(t_textureCoordinateId),Array<c_CalTangentSpace* >(t_vertexCount));
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<121>");
			gc_assign(m_m_vectorvectorTangentSpace.At(t_textureCoordinateId),Array<c_CalTangentSpace* >(0));
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<125>");
	gc_assign(m_m_vectorFace,Array<c_CalFace* >(t_faceCount));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<126>");
	gc_assign(m_m_vectorSpring,Array<c_CalSpring* >(t_springCount));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<129>");
	if(t_springCount>0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<130>");
		gc_assign(m_m_vectorPhysicalProperty,Array<c_CalPhysicalProperty* >(t_vertexCount));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<132>");
	return true;
}
bool c_CalCoreSubmesh::p_setTextureCoordinate(int t_vertexId,int t_textureCoordinateId,c_CalTextureCoordinate* t_textureCoordinate){
	DBG_ENTER("CalCoreSubmesh.setTextureCoordinate")
	c_CalCoreSubmesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_vertexId,"vertexId")
	DBG_LOCAL(t_textureCoordinateId,"textureCoordinateId")
	DBG_LOCAL(t_textureCoordinate,"textureCoordinate")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<209>");
	if(t_textureCoordinateId<0 || t_textureCoordinateId>=m_m_vectorvectorTextureCoordinate.Length()){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<210>");
		return false;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<212>");
	if(t_vertexId<0 || t_vertexId>=m_m_vectorvectorTextureCoordinate.At(t_textureCoordinateId).Length()){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<213>");
		return false;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<216>");
	gc_assign(m_m_vectorvectorTextureCoordinate.At(t_textureCoordinateId).At(t_vertexId),t_textureCoordinate);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<217>");
	return true;
}
bool c_CalCoreSubmesh::p_setVertex(int t_vertexId,c_CalVertex* t_vertex){
	DBG_ENTER("CalCoreSubmesh.setVertex")
	c_CalCoreSubmesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_vertexId,"vertexId")
	DBG_LOCAL(t_vertex,"vertex")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<224>");
	if(t_vertexId<0 || t_vertexId>=m_m_vectorVertex.Length()){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<225>");
		return false;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<228>");
	gc_assign(m_m_vectorVertex.At(t_vertexId),t_vertex);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<229>");
	return true;
}
bool c_CalCoreSubmesh::p_setFace(int t_faceId,c_CalFace* t_face){
	DBG_ENTER("CalCoreSubmesh.setFace")
	c_CalCoreSubmesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_faceId,"faceId")
	DBG_LOCAL(t_face,"face")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<144>");
	if(t_faceId<0 || t_faceId>=m_m_vectorFace.Length()){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<145>");
		return false;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<148>");
	gc_assign(m_m_vectorFace.At(t_faceId),t_face);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<149>");
	return true;
}
void c_CalCoreSubmesh::mark(){
	Object::mark();
	gc_mark_q(m_m_vectorSpring);
	gc_mark_q(m_m_vectorVertex);
	gc_mark_q(m_m_vectorCoreSubMorphTarget);
	gc_mark_q(m_m_vectorFace);
	gc_mark_q(m_m_vectorvectorTangentSpace);
	gc_mark_q(m_m_vectorPhysicalProperty);
	gc_mark_q(m_m_vectorTangentsEnabled);
	gc_mark_q(m_m_vectorvectorTextureCoordinate);
}
String c_CalCoreSubmesh::debug(){
	String t="(CalCoreSubmesh)\n";
	t+=dbg_decl("m_vectorVertex",&m_m_vectorVertex);
	t+=dbg_decl("m_vectorTangentsEnabled",&m_m_vectorTangentsEnabled);
	t+=dbg_decl("m_vectorvectorTangentSpace",&m_m_vectorvectorTangentSpace);
	t+=dbg_decl("m_vectorvectorTextureCoordinate",&m_m_vectorvectorTextureCoordinate);
	t+=dbg_decl("m_vectorPhysicalProperty",&m_m_vectorPhysicalProperty);
	t+=dbg_decl("m_vectorFace",&m_m_vectorFace);
	t+=dbg_decl("m_vectorSpring",&m_m_vectorSpring);
	t+=dbg_decl("m_vectorCoreSubMorphTarget",&m_m_vectorCoreSubMorphTarget);
	t+=dbg_decl("m_coreMaterialThreadId",&m_m_coreMaterialThreadId);
	t+=dbg_decl("m_lodCount",&m_m_lodCount);
	return t;
}
c_CalSpring::c_CalSpring(){
	m_vertexId=Array<int >(2);
	m_idleLength=FLOAT(.0);
}
void c_CalSpring::mark(){
	Object::mark();
	gc_mark_q(m_vertexId);
}
String c_CalSpring::debug(){
	String t="(CalSpring)\n";
	t+=dbg_decl("vertexId",&m_vertexId);
	t+=dbg_decl("idleLength",&m_idleLength);
	return t;
}
c_CalInfluence::c_CalInfluence(){
	m_boneId=0;
	m_weight=FLOAT(.0);
}
c_CalInfluence* c_CalInfluence::m_new(){
	DBG_ENTER("CalInfluence.new")
	c_CalInfluence *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<389>");
	m_boneId=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<390>");
	m_weight=FLOAT(0.0);
	return this;
}
c_CalInfluence* c_CalInfluence::m_new2(int t_b,Float t_w){
	DBG_ENTER("CalInfluence.new")
	c_CalInfluence *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_b,"b")
	DBG_LOCAL(t_w,"w")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<395>");
	m_boneId=t_b;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<396>");
	m_weight=t_w;
	return this;
}
void c_CalInfluence::mark(){
	Object::mark();
}
String c_CalInfluence::debug(){
	String t="(CalInfluence)\n";
	t+=dbg_decl("boneId",&m_boneId);
	t+=dbg_decl("weight",&m_weight);
	return t;
}
c_CalModel::c_CalModel(){
	m_m_coreModel=0;
	m_m_skeleton=0;
	m_m_mixer=0;
	m_m_morphTargetMixer=0;
	m_m_physique=0;
	m_m_springSystem=0;
	m_m_renderer=0;
	m_m_userData=0;
	m_m_vectorMesh=Array<c_CalMesh* >();
	m_m_boundingBox=0;
}
c_CalCoreModel* c_CalModel::p_getCoreModel(){
	DBG_ENTER("CalModel.getCoreModel")
	c_CalModel *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<110>");
	return m_m_coreModel;
}
c_CalModel* c_CalModel::m_new(){
	DBG_ENTER("CalModel.new")
	c_CalModel *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<17>");
	m_m_coreModel=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<18>");
	m_m_skeleton=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<19>");
	gc_assign(m_m_mixer,(new c_CalMixer)->m_new2());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<20>");
	gc_assign(m_m_morphTargetMixer,(new c_CalMorphTargetMixer)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<21>");
	gc_assign(m_m_physique,(new c_CalPhysique)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<22>");
	gc_assign(m_m_springSystem,(new c_CalSpringSystem)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<23>");
	gc_assign(m_m_renderer,(new c_CalRenderer)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<24>");
	m_m_userData=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<25>");
	gc_assign(m_m_vectorMesh,Array<c_CalMesh* >(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<26>");
	gc_assign(m_m_boundingBox,(new c_CalBoundingBox)->m_new());
	return this;
}
c_CalModel* c_CalModel::m_new2(c_CalCoreModel* t_coreModel){
	DBG_ENTER("CalModel.new")
	c_CalModel *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_coreModel,"coreModel")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<31>");
	gc_assign(m_m_coreModel,t_coreModel);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<32>");
	gc_assign(m_m_skeleton,(new c_CalSkeleton)->m_new2(t_coreModel->p_getCoreSkeleton()));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<33>");
	gc_assign(m_m_mixer,(new c_CalMixer)->m_new(this));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<34>");
	gc_assign(m_m_morphTargetMixer,(new c_CalMorphTargetMixer)->m_new2(this));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<35>");
	gc_assign(m_m_physique,(new c_CalPhysique)->m_new2(this));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<36>");
	gc_assign(m_m_springSystem,(new c_CalSpringSystem)->m_new2(this));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<37>");
	gc_assign(m_m_renderer,(new c_CalRenderer)->m_new2(this));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<38>");
	m_m_userData=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<39>");
	gc_assign(m_m_vectorMesh,Array<c_CalMesh* >(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<40>");
	gc_assign(m_m_boundingBox,(new c_CalBoundingBox)->m_new());
	return this;
}
bool c_CalModel::p_attachMesh(int t_coreMeshId){
	DBG_ENTER("CalModel.attachMesh")
	c_CalModel *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_coreMeshId,"coreMeshId")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<47>");
	if(t_coreMeshId<0 || t_coreMeshId>=m_m_coreModel->p_getCoreMeshCount()){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<48>");
		bbPrint(String(L"Invalid Mesh ID 8===D -o -o",27));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<49>");
		return false;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<53>");
	c_CalCoreMesh* t_coreMesh=m_m_coreModel->p_getCoreMesh(t_coreMeshId);
	DBG_LOCAL(t_coreMesh,"coreMesh")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<56>");
	for(int t_meshId=0;t_meshId<=m_m_vectorMesh.Length()-1;t_meshId=t_meshId+1){
		DBG_BLOCK();
		DBG_LOCAL(t_meshId,"meshId")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<58>");
		if(m_m_vectorMesh.At(t_meshId)->p_getCoreMesh2()==t_coreMesh){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<60>");
			return true;
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<65>");
	c_CalMesh* t_mesh=(new c_CalMesh)->m_new2(t_coreMesh);
	DBG_LOCAL(t_mesh,"mesh")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<68>");
	t_mesh->p_setModel(this);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<71>");
	gc_assign(m_m_vectorMesh,m_m_vectorMesh.Resize(m_m_vectorMesh.Length()+1));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<72>");
	gc_assign(m_m_vectorMesh.At(m_m_vectorMesh.Length()-1),t_mesh);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<74>");
	return true;
}
c_CalRenderer* c_CalModel::p_getRenderer(){
	DBG_ENTER("CalModel.getRenderer")
	c_CalModel *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<167>");
	return m_m_renderer;
}
Array<c_CalMesh* > c_CalModel::p_getVectorMesh(){
	DBG_ENTER("CalModel.getVectorMesh")
	c_CalModel *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<241>");
	return m_m_vectorMesh;
}
c_CalPhysique* c_CalModel::p_getPhysique(){
	DBG_ENTER("CalModel.getPhysique")
	c_CalModel *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<163>");
	return m_m_physique;
}
c_CalSkeleton* c_CalModel::p_getSkeleton(){
	DBG_ENTER("CalModel.getSkeleton")
	c_CalModel *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<171>");
	return m_m_skeleton;
}
c_CalMixer* c_CalModel::p_getMixer(){
	DBG_ENTER("CalModel.getMixer")
	c_CalModel *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<137>");
	if(m_m_mixer==0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<138>");
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<141>");
	if(m_m_mixer->p_isDefaultMixer()==false){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<142>");
		bbPrint(String(L"Invalid Mixer",13));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<143>");
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<146>");
	return m_m_mixer;
}
Object* c_CalModel::p_getUserData(){
	DBG_ENTER("CalModel.getUserData")
	c_CalModel *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<237>");
	return m_m_userData;
}
c_CalMesh* c_CalModel::p_getMesh(int t_coreMeshId){
	DBG_ENTER("CalModel.getMesh")
	c_CalModel *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_coreMeshId,"coreMeshId")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<117>");
	if(t_coreMeshId<0 || t_coreMeshId>=m_m_coreModel->p_getCoreMeshCount()){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<118>");
		bbPrint(String(L"Invalid Mesh ID",15));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<119>");
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<123>");
	c_CalCoreMesh* t_coreMesh=m_m_coreModel->p_getCoreMesh(t_coreMeshId);
	DBG_LOCAL(t_coreMesh,"coreMesh")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<126>");
	for(int t_meshId=0;t_meshId<=m_m_vectorMesh.Length()-1;t_meshId=t_meshId+1){
		DBG_BLOCK();
		DBG_LOCAL(t_meshId,"meshId")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<128>");
		if(m_m_vectorMesh.At(t_meshId)->p_getCoreMesh2()==t_coreMesh){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<129>");
			return m_m_vectorMesh.At(t_meshId);
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<133>");
	return 0;
}
void c_CalModel::p_update(Float t_deltaTime){
	DBG_ENTER("CalModel.update")
	c_CalModel *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_deltaTime,"deltaTime")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<265>");
	m_m_mixer->p_updateAnimation(t_deltaTime);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<266>");
	m_m_mixer->p_updateSkeleton();
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<268>");
	m_m_morphTargetMixer->p_update(t_deltaTime);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<269>");
	m_m_physique->p_update2();
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/model.monkey<270>");
	m_m_springSystem->p_update(t_deltaTime);
}
void c_CalModel::mark(){
	Object::mark();
	gc_mark_q(m_m_coreModel);
	gc_mark_q(m_m_skeleton);
	gc_mark_q(m_m_mixer);
	gc_mark_q(m_m_morphTargetMixer);
	gc_mark_q(m_m_physique);
	gc_mark_q(m_m_springSystem);
	gc_mark_q(m_m_renderer);
	gc_mark_q(m_m_userData);
	gc_mark_q(m_m_vectorMesh);
	gc_mark_q(m_m_boundingBox);
}
String c_CalModel::debug(){
	String t="(CalModel)\n";
	t+=dbg_decl("m_coreModel",&m_m_coreModel);
	t+=dbg_decl("m_skeleton",&m_m_skeleton);
	t+=dbg_decl("m_mixer",&m_m_mixer);
	t+=dbg_decl("m_morphTargetMixer",&m_m_morphTargetMixer);
	t+=dbg_decl("m_physique",&m_m_physique);
	t+=dbg_decl("m_springSystem",&m_m_springSystem);
	t+=dbg_decl("m_renderer",&m_m_renderer);
	t+=dbg_decl("m_userData",&m_m_userData);
	t+=dbg_decl("m_vectorMesh",&m_m_vectorMesh);
	t+=dbg_decl("m_boundingBox",&m_m_boundingBox);
	return t;
}
c_CalSkeleton::c_CalSkeleton(){
	m_m_coreSkeleton=0;
	m_m_vectorBone=Array<c_CalBone* >();
	m_m_isBoundingBoxesComputed=false;
}
c_CalSkeleton* c_CalSkeleton::m_new(){
	DBG_ENTER("CalSkeleton.new")
	c_CalSkeleton *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/skeleton.monkey<11>");
	m_m_coreSkeleton=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/skeleton.monkey<12>");
	gc_assign(m_m_vectorBone,Array<c_CalBone* >(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/skeleton.monkey<13>");
	m_m_isBoundingBoxesComputed=false;
	return this;
}
c_CalSkeleton* c_CalSkeleton::m_new2(c_CalCoreSkeleton* t_coreSkeleton){
	DBG_ENTER("CalSkeleton.new")
	c_CalSkeleton *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_coreSkeleton,"coreSkeleton")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/skeleton.monkey<18>");
	gc_assign(m_m_coreSkeleton,t_coreSkeleton);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/skeleton.monkey<19>");
	gc_assign(m_m_vectorBone,Array<c_CalBone* >(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/skeleton.monkey<20>");
	m_m_isBoundingBoxesComputed=false;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/skeleton.monkey<22>");
	Array<c_CalCoreBone* > t_vectorCoreBone=t_coreSkeleton->p_getVectorCoreBone();
	DBG_LOCAL(t_vectorCoreBone,"vectorCoreBone")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/skeleton.monkey<24>");
	int t_boneCount=t_vectorCoreBone.Length();
	DBG_LOCAL(t_boneCount,"boneCount")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/skeleton.monkey<26>");
	for(int t_boneId=0;t_boneId<=t_boneCount-1;t_boneId=t_boneId+1){
		DBG_BLOCK();
		DBG_LOCAL(t_boneId,"boneId")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/skeleton.monkey<27>");
		c_CalBone* t_bone=(new c_CalBone)->m_new2(t_vectorCoreBone.At(t_boneId));
		DBG_LOCAL(t_bone,"bone")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/skeleton.monkey<30>");
		t_bone->p_setSkeleton(this);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/skeleton.monkey<33>");
		gc_assign(m_m_vectorBone,m_m_vectorBone.Resize(m_m_vectorBone.Length()+1));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/skeleton.monkey<34>");
		gc_assign(m_m_vectorBone.At(m_m_vectorBone.Length()-1),t_bone);
	}
	return this;
}
Array<c_CalBone* > c_CalSkeleton::p_getVectorBone(){
	DBG_ENTER("CalSkeleton.getVectorBone")
	c_CalSkeleton *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/skeleton.monkey<71>");
	return m_m_vectorBone;
}
void c_CalSkeleton::p_clearState(){
	DBG_ENTER("CalSkeleton.clearState")
	c_CalSkeleton *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/skeleton.monkey<52>");
	for(int t_boneId=0;t_boneId<=m_m_vectorBone.Length()-1;t_boneId=t_boneId+1){
		DBG_BLOCK();
		DBG_LOCAL(t_boneId,"boneId")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/skeleton.monkey<53>");
		m_m_vectorBone.At(t_boneId)->p_clearState();
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/skeleton.monkey<55>");
	m_m_isBoundingBoxesComputed=false;
}
void c_CalSkeleton::p_lockState(){
	DBG_ENTER("CalSkeleton.lockState")
	c_CalSkeleton *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/skeleton.monkey<80>");
	for(int t_boneId=0;t_boneId<=m_m_vectorBone.Length()-1;t_boneId=t_boneId+1){
		DBG_BLOCK();
		DBG_LOCAL(t_boneId,"boneId")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/skeleton.monkey<81>");
		m_m_vectorBone.At(t_boneId)->p_lockState();
	}
}
c_CalBone* c_CalSkeleton::p_getBone(int t_boneId){
	DBG_ENTER("CalSkeleton.getBone")
	c_CalSkeleton *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_boneId,"boneId")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/skeleton.monkey<63>");
	return m_m_vectorBone.At(t_boneId);
}
void c_CalSkeleton::p_calculateState(){
	DBG_ENTER("CalSkeleton.calculateState")
	c_CalSkeleton *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/skeleton.monkey<42>");
	Array<int > t_listRootCoreBoneId=m_m_coreSkeleton->p_getVectorRootCoreBoneId();
	DBG_LOCAL(t_listRootCoreBoneId,"listRootCoreBoneId")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/skeleton.monkey<44>");
	for(int t_iRootCoreBoneId=0;t_iRootCoreBoneId<=t_listRootCoreBoneId.Length()-1;t_iRootCoreBoneId=t_iRootCoreBoneId+1){
		DBG_BLOCK();
		DBG_LOCAL(t_iRootCoreBoneId,"iRootCoreBoneId")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/skeleton.monkey<45>");
		m_m_vectorBone.At(t_listRootCoreBoneId.At(t_iRootCoreBoneId))->p_calculateState();
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/skeleton.monkey<47>");
	m_m_isBoundingBoxesComputed=false;
}
void c_CalSkeleton::mark(){
	Object::mark();
	gc_mark_q(m_m_coreSkeleton);
	gc_mark_q(m_m_vectorBone);
}
String c_CalSkeleton::debug(){
	String t="(CalSkeleton)\n";
	t+=dbg_decl("m_coreSkeleton",&m_m_coreSkeleton);
	t+=dbg_decl("m_vectorBone",&m_m_vectorBone);
	t+=dbg_decl("m_isBoundingBoxesComputed",&m_m_isBoundingBoxesComputed);
	return t;
}
c_CalAbstractMixer::c_CalAbstractMixer(){
}
c_CalAbstractMixer* c_CalAbstractMixer::m_new(){
	DBG_ENTER("CalAbstractMixer.new")
	c_CalAbstractMixer *self=this;
	DBG_LOCAL(self,"Self")
	return this;
}
c_CalAbstractMixer* c_CalAbstractMixer::m_new2(c_CalModel* t_model){
	DBG_ENTER("CalAbstractMixer.new")
	c_CalAbstractMixer *self=this;
	DBG_LOCAL(self,"Self")
	return this;
}
bool c_CalAbstractMixer::p_isDefaultMixer(){
	DBG_ENTER("CalAbstractMixer.isDefaultMixer")
	c_CalAbstractMixer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<15>");
	return false;
}
void c_CalAbstractMixer::p_updateAnimation(Float t_deltaTime){
	DBG_ENTER("CalAbstractMixer.updateAnimation")
	c_CalAbstractMixer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_deltaTime,"deltaTime")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<19>");
	bbPrint(String(L"This is the abstract mixer! Use one of the extended classes!",60));
}
void c_CalAbstractMixer::p_updateSkeleton(){
	DBG_ENTER("CalAbstractMixer.updateSkeleton")
	c_CalAbstractMixer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<23>");
	bbPrint(String(L"This is the abstract mixer! Use one of the extended classes!",60));
}
void c_CalAbstractMixer::mark(){
	Object::mark();
}
String c_CalAbstractMixer::debug(){
	String t="(CalAbstractMixer)\n";
	return t;
}
c_CalMixer::c_CalMixer(){
	m_m_model=0;
	m_m_vectorAnimation=Array<c_CalAnimation* >();
	m_m_listAnimationAction=Array<c_CalAnimationAction* >();
	m_m_listAnimationCycle=Array<c_CalAnimationCycle* >();
	m_m_animationTime=FLOAT(.0);
	m_m_animationDuration=FLOAT(.0);
	m_m_timeFactor=FLOAT(.0);
}
c_CalMixer* c_CalMixer::m_new(c_CalModel* t_model){
	DBG_ENTER("CalMixer.new")
	c_CalMixer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_model,"model")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<39>");
	c_CalAbstractMixer::m_new();
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<40>");
	gc_assign(m_m_model,t_model);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<41>");
	gc_assign(m_m_vectorAnimation,Array<c_CalAnimation* >(t_model->p_getCoreModel()->p_getCoreAnimationCount()));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<42>");
	gc_assign(m_m_listAnimationAction,Array<c_CalAnimationAction* >(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<43>");
	gc_assign(m_m_listAnimationCycle,Array<c_CalAnimationCycle* >(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<44>");
	m_m_animationTime=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<45>");
	m_m_animationDuration=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<46>");
	m_m_timeFactor=FLOAT(1.0);
	return this;
}
c_CalMixer* c_CalMixer::m_new2(){
	DBG_ENTER("CalMixer.new")
	c_CalMixer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<29>");
	c_CalAbstractMixer::m_new();
	return this;
}
bool c_CalMixer::p_isDefaultMixer(){
	DBG_ENTER("CalMixer.isDefaultMixer")
	c_CalMixer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<52>");
	return true;
}
bool c_CalMixer::p_blendCycle(int t_id,Float t_weight,Float t_delay){
	DBG_ENTER("CalMixer.blendCycle")
	c_CalMixer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_id,"id")
	DBG_LOCAL(t_weight,"weight")
	DBG_LOCAL(t_delay,"delay")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<57>");
	if(t_id<0 || t_id>=m_m_vectorAnimation.Length()){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<58>");
		bbPrint(String(L"Invalid Animation ID",20));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<59>");
		return false;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<63>");
	c_CalAnimation* t_animation=m_m_vectorAnimation.At(t_id);
	DBG_LOCAL(t_animation,"animation")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<66>");
	if(t_animation==0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<68>");
		if(t_weight==FLOAT(0.0)){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<69>");
			return true;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<72>");
		c_CalCoreAnimation* t_coreAnimation=m_m_model->p_getCoreModel()->p_getCoreAnimation(t_id);
		DBG_LOCAL(t_coreAnimation,"coreAnimation")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<73>");
		if(t_coreAnimation==0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<74>");
			return false;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<77>");
		bb_mixer_addExtraKeyframeForLoopedAnim(t_coreAnimation);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<80>");
		c_CalAnimationCycle* t_animationCycle=(new c_CalAnimationCycle)->m_new2(t_coreAnimation);
		DBG_LOCAL(t_animationCycle,"animationCycle")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<83>");
		gc_assign(m_m_vectorAnimation.At(t_id),(t_animationCycle));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<84>");
		Array<c_CalAnimationCycle* > t_lac=Array<c_CalAnimationCycle* >(m_m_listAnimationCycle.Length()+1);
		DBG_LOCAL(t_lac,"lac")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<85>");
		for(int t_i=1;t_i<=m_m_listAnimationCycle.Length();t_i=t_i+1){
			DBG_BLOCK();
			DBG_LOCAL(t_i,"i")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<86>");
			gc_assign(t_lac.At(t_i),m_m_listAnimationCycle.At(t_i-1));
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<88>");
		gc_assign(t_lac.At(0),t_animationCycle);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<89>");
		gc_assign(m_m_listAnimationCycle,t_lac);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<92>");
		bool t_=t_animationCycle->p_blend3(t_weight,t_delay);
		return t_;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<96>");
	if(t_animation->p_getType()!=1){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<97>");
		bbPrint(String(L"Not Animation Cycle Class",25));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<98>");
		return false;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<102>");
	if(t_weight==FLOAT(0.0)){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<103>");
		m_m_vectorAnimation.At(t_id)=0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<107>");
	c_CalAnimationCycle* t_animationCycle2=dynamic_cast<c_CalAnimationCycle*>(t_animation);
	DBG_LOCAL(t_animationCycle2,"animationCycle")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<110>");
	t_animationCycle2->p_blend3(t_weight,t_delay);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<111>");
	t_animationCycle2->p_checkCallbacks(FLOAT(0.0),m_m_model);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<113>");
	return true;
}
void c_CalMixer::p_updateAnimation(Float t_deltaTime){
	DBG_ENTER("CalMixer.updateAnimation")
	c_CalMixer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_deltaTime,"deltaTime")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<224>");
	if(m_m_animationDuration==FLOAT(0.0)){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<225>");
		m_m_animationTime=FLOAT(0.0);
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<227>");
		m_m_animationTime+=t_deltaTime*m_m_timeFactor;
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<229>");
		if(m_m_animationTime>=m_m_animationDuration || m_m_animationTime<FLOAT(0.0)){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<230>");
			m_m_animationTime=bb_animation_Modf(m_m_animationTime,m_m_animationDuration);
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<233>");
		if(m_m_animationTime<FLOAT(0.0)){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<234>");
			m_m_animationTime=m_m_animationTime+m_m_animationDuration;
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<239>");
	int t_animationActionId=0;
	DBG_LOCAL(t_animationActionId,"animationActionId")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<241>");
	while(t_animationActionId<m_m_listAnimationAction.Length()){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<243>");
		c_CalAnimationAction* t_animationAction=m_m_listAnimationAction.At(t_animationActionId);
		DBG_LOCAL(t_animationAction,"animationAction")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<245>");
		if(t_animationAction->p_update(t_deltaTime)){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<246>");
			t_animationAction->p_checkCallbacks(t_animationAction->p_getTime(),m_m_model);
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<247>");
			t_animationActionId=t_animationActionId+1;
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<250>");
			t_animationAction->p_completeCallbacks(m_m_model);
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<251>");
			Array<c_CalAnimationAction* > t_laa=Array<c_CalAnimationAction* >(m_m_listAnimationAction.Length()-1);
			DBG_LOCAL(t_laa,"laa")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<252>");
			int t_pos=0;
			DBG_LOCAL(t_pos,"pos")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<253>");
			for(int t_i=0;t_i<=m_m_listAnimationAction.Length()-1;t_i=t_i+1){
				DBG_BLOCK();
				DBG_LOCAL(t_i,"i")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<254>");
				if(t_i!=t_animationActionId){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<255>");
					gc_assign(t_laa.At(t_pos),m_m_listAnimationAction.At(t_i));
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<256>");
					t_pos=t_pos+1;
				}
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<259>");
			gc_assign(m_m_listAnimationAction,t_laa);
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<267>");
	Float t_accumulatedWeight=FLOAT(0.0);
	DBG_LOCAL(t_accumulatedWeight,"accumulatedWeight")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<268>");
	Float t_accumulatedDuration=FLOAT(0.0);
	DBG_LOCAL(t_accumulatedDuration,"accumulatedDuration")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<269>");
	int t_animationCycleId=0;
	DBG_LOCAL(t_animationCycleId,"animationCycleId")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<270>");
	while(t_animationCycleId<m_m_listAnimationCycle.Length()){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<271>");
		c_CalAnimationCycle* t_animationCycle=m_m_listAnimationCycle.At(t_animationCycleId);
		DBG_LOCAL(t_animationCycle,"animationCycle")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<273>");
		if(t_animationCycle->p_update(t_deltaTime)==true){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<275>");
			if(t_animationCycle->p_getState()==1){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<276>");
				t_accumulatedWeight+=t_animationCycle->p_getWeight();
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<277>");
				t_accumulatedDuration+=t_animationCycle->p_getWeight()*t_animationCycle->p_getCoreAnimation2()->p_getDuration();
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<280>");
			t_animationCycle->p_checkCallbacks(m_m_animationTime,m_m_model);
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<281>");
			t_animationCycleId=t_animationCycleId+1;
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<285>");
			t_animationCycle->p_completeCallbacks(m_m_model);
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<286>");
			Array<c_CalAnimationCycle* > t_lac=Array<c_CalAnimationCycle* >(m_m_listAnimationCycle.Length()-1);
			DBG_LOCAL(t_lac,"lac")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<287>");
			int t_pos2=0;
			DBG_LOCAL(t_pos2,"pos")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<288>");
			for(int t_i2=0;t_i2<=m_m_listAnimationCycle.Length()-1;t_i2=t_i2+1){
				DBG_BLOCK();
				DBG_LOCAL(t_i2,"i")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<289>");
				if(t_i2!=t_animationCycleId){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<290>");
					gc_assign(t_lac.At(t_pos2),m_m_listAnimationCycle.At(t_i2));
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<291>");
					t_pos2=t_pos2+1;
				}
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<294>");
			gc_assign(m_m_listAnimationCycle,t_lac);
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<299>");
	if(t_accumulatedWeight>FLOAT(0.0)){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<300>");
		m_m_animationDuration=t_accumulatedDuration/t_accumulatedWeight;
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<302>");
		m_m_animationDuration=FLOAT(0.0);
	}
}
void c_CalMixer::p_updateSkeleton(){
	DBG_ENTER("CalMixer.updateSkeleton")
	c_CalMixer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<311>");
	c_CalSkeleton* t_skeleton=m_m_model->p_getSkeleton();
	DBG_LOCAL(t_skeleton,"skeleton")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<312>");
	if(t_skeleton==0){
		DBG_BLOCK();
		return;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<316>");
	t_skeleton->p_clearState();
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<319>");
	Array<c_CalBone* > t_vectorBone=t_skeleton->p_getVectorBone();
	DBG_LOCAL(t_vectorBone,"vectorBone")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<321>");
	c_CalVector* t_translation=(new c_CalVector)->m_new();
	DBG_LOCAL(t_translation,"translation")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<322>");
	c_CalQuaternion* t_rotation=(new c_CalQuaternion)->m_new();
	DBG_LOCAL(t_rotation,"rotation")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<325>");
	for(int t_animationActionId=0;t_animationActionId<=m_m_listAnimationAction.Length()-1;t_animationActionId=t_animationActionId+1){
		DBG_BLOCK();
		DBG_LOCAL(t_animationActionId,"animationActionId")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<326>");
		c_CalAnimationAction* t_animationAction=m_m_listAnimationAction.At(t_animationActionId);
		DBG_LOCAL(t_animationAction,"animationAction")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<329>");
		c_CalCoreAnimation* t_coreAnimation=t_animationAction->p_getCoreAnimation2();
		DBG_LOCAL(t_coreAnimation,"coreAnimation")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<332>");
		Array<c_CalCoreTrack* > t_listCoreTrack=t_coreAnimation->p_getListCoreTrack();
		DBG_LOCAL(t_listCoreTrack,"listCoreTrack")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<335>");
		for(int t_coreTrackId=0;t_coreTrackId<=t_listCoreTrack.Length()-1;t_coreTrackId=t_coreTrackId+1){
			DBG_BLOCK();
			DBG_LOCAL(t_coreTrackId,"coreTrackId")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<337>");
			c_CalBone* t_bone=t_vectorBone.At(t_listCoreTrack.At(t_coreTrackId)->p_getCoreBoneId2());
			DBG_LOCAL(t_bone,"bone")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<340>");
			t_listCoreTrack.At(t_coreTrackId)->p_getState2(t_animationAction->p_getTime(),t_translation,t_rotation);
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<343>");
			t_bone->p_blendState(t_animationAction->p_getWeight(),t_translation,t_rotation);
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<348>");
	t_skeleton->p_lockState();
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<351>");
	for(int t_animationCycleId=0;t_animationCycleId<=m_m_listAnimationCycle.Length()-1;t_animationCycleId=t_animationCycleId+1){
		DBG_BLOCK();
		DBG_LOCAL(t_animationCycleId,"animationCycleId")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<352>");
		c_CalAnimationCycle* t_animationCycle=m_m_listAnimationCycle.At(t_animationCycleId);
		DBG_LOCAL(t_animationCycle,"animationCycle")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<355>");
		c_CalCoreAnimation* t_coreAnimation2=t_animationCycle->p_getCoreAnimation2();
		DBG_LOCAL(t_coreAnimation2,"coreAnimation")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<358>");
		Float t_animationTime=FLOAT(.0);
		DBG_LOCAL(t_animationTime,"animationTime")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<359>");
		if(t_animationCycle->p_getState()==1){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<360>");
			if(m_m_animationDuration==FLOAT(0.0)){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<361>");
				t_animationTime=FLOAT(0.0);
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<363>");
				t_animationTime=m_m_animationTime*t_coreAnimation2->p_getDuration()/m_m_animationDuration;
			}
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<366>");
			t_animationTime=t_animationCycle->p_getTime();
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<369>");
		Array<c_CalCoreTrack* > t_listCoreTrack2=t_coreAnimation2->p_getListCoreTrack();
		DBG_LOCAL(t_listCoreTrack2,"listCoreTrack")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<372>");
		for(int t_coreTrackId2=0;t_coreTrackId2<=t_listCoreTrack2.Length()-1;t_coreTrackId2=t_coreTrackId2+1){
			DBG_BLOCK();
			DBG_LOCAL(t_coreTrackId2,"coreTrackId")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<374>");
			c_CalBone* t_bone2=t_vectorBone.At(t_listCoreTrack2.At(t_coreTrackId2)->p_getCoreBoneId2());
			DBG_LOCAL(t_bone2,"bone")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<377>");
			t_listCoreTrack2.At(t_coreTrackId2)->p_getState2(t_animationTime,t_translation,t_rotation);
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<380>");
			t_bone2->p_blendState(t_animationCycle->p_getWeight(),t_translation,t_rotation);
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<385>");
	t_skeleton->p_lockState();
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<388>");
	t_skeleton->p_calculateState();
}
void c_CalMixer::mark(){
	c_CalAbstractMixer::mark();
	gc_mark_q(m_m_model);
	gc_mark_q(m_m_vectorAnimation);
	gc_mark_q(m_m_listAnimationAction);
	gc_mark_q(m_m_listAnimationCycle);
}
String c_CalMixer::debug(){
	String t="(CalMixer)\n";
	t=c_CalAbstractMixer::debug()+t;
	t+=dbg_decl("m_model",&m_m_model);
	t+=dbg_decl("m_vectorAnimation",&m_m_vectorAnimation);
	t+=dbg_decl("m_listAnimationAction",&m_m_listAnimationAction);
	t+=dbg_decl("m_listAnimationCycle",&m_m_listAnimationCycle);
	t+=dbg_decl("m_animationTime",&m_m_animationTime);
	t+=dbg_decl("m_animationDuration",&m_m_animationDuration);
	t+=dbg_decl("m_timeFactor",&m_m_timeFactor);
	return t;
}
c_CalAnimation::c_CalAnimation(){
	m_m_coreAnimation=0;
	m_m_lastCallbackTimes=Array<Float >();
	m_m_type=0;
	m_m_state=0;
	m_m_time=FLOAT(.0);
	m_m_timeFactor=FLOAT(.0);
	m_m_weight=FLOAT(.0);
}
c_CalAnimation* c_CalAnimation::m_new(){
	DBG_ENTER("CalAnimation.new")
	c_CalAnimation *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<16>");
	m_m_coreAnimation=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<17>");
	gc_assign(m_m_lastCallbackTimes,Array<Float >(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<18>");
	m_m_type=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<19>");
	m_m_state=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<20>");
	m_m_time=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<21>");
	m_m_timeFactor=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<22>");
	m_m_weight=FLOAT(0.0);
	return this;
}
c_CalAnimation* c_CalAnimation::m_new2(c_CalCoreAnimation* t_coreAnimation){
	DBG_ENTER("CalAnimation.new")
	c_CalAnimation *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_coreAnimation,"coreAnimation")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<30>");
	gc_assign(m_m_coreAnimation,t_coreAnimation);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<31>");
	gc_assign(m_m_lastCallbackTimes,Array<Float >(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<32>");
	m_m_type=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<33>");
	m_m_state=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<34>");
	m_m_time=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<35>");
	m_m_timeFactor=FLOAT(1.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<36>");
	m_m_weight=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<39>");
	Array<c_CalCallbackRecord* > t_callbackList=t_coreAnimation->p_getCallbackList();
	DBG_LOCAL(t_callbackList,"callbackList")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<40>");
	for(int t_i=0;t_i<=t_callbackList.Length()-1;t_i=t_i+1){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<41>");
		gc_assign(m_m_lastCallbackTimes,m_m_lastCallbackTimes.Resize(m_m_lastCallbackTimes.Length()+1));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<42>");
		m_m_lastCallbackTimes.At(m_m_lastCallbackTimes.Length()-1)=FLOAT(0.0);
	}
	return this;
}
void c_CalAnimation::p_setType(int t_type){
	DBG_ENTER("CalAnimation.setType")
	c_CalAnimation *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_type,"type")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<109>");
	m_m_type=t_type;
}
void c_CalAnimation::p_setState(int t_state){
	DBG_ENTER("CalAnimation.setState")
	c_CalAnimation *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_state,"state")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<113>");
	m_m_state=t_state;
}
void c_CalAnimation::p_setWeight(Float t_weight){
	DBG_ENTER("CalAnimation.setWeight")
	c_CalAnimation *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_weight,"weight")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<117>");
	m_m_weight=t_weight;
}
int c_CalAnimation::p_getType(){
	DBG_ENTER("CalAnimation.getType")
	c_CalAnimation *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<61>");
	return m_m_type;
}
void c_CalAnimation::p_checkCallbacks(Float t_animationTime,c_CalModel* t_model){
	DBG_ENTER("CalAnimation.checkCallbacks")
	c_CalAnimation *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_animationTime,"animationTime")
	DBG_LOCAL(t_model,"model")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<81>");
	Array<c_CalCallbackRecord* > t_callbackList=m_m_coreAnimation->p_getCallbackList();
	DBG_LOCAL(t_callbackList,"callbackList")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<82>");
	for(int t_i=0;t_i<=t_callbackList.Length()-1;t_i=t_i+1){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<84>");
		if(m_m_lastCallbackTimes.Length()<=t_i){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<85>");
			gc_assign(m_m_lastCallbackTimes,m_m_lastCallbackTimes.Resize(m_m_lastCallbackTimes.Length()+1));
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<86>");
			m_m_lastCallbackTimes.At(m_m_lastCallbackTimes.Length()-1)=t_animationTime;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<88>");
		t_callbackList.At(t_i)->m_callback->p_AnimationUpdate(t_animationTime,t_model,t_model->p_getUserData());
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<89>");
		if(t_animationTime>FLOAT(0.0) && t_animationTime<m_m_lastCallbackTimes.At(t_i)){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<90>");
			m_m_lastCallbackTimes.At(t_i)-=m_m_coreAnimation->p_getDuration();
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<91>");
			if(t_animationTime<FLOAT(0.0) && t_animationTime>m_m_lastCallbackTimes.At(t_i)){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<92>");
				m_m_lastCallbackTimes.At(t_i)+=m_m_coreAnimation->p_getDuration();
			}
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<94>");
		if(t_animationTime>=FLOAT(0.0) && t_animationTime>=m_m_lastCallbackTimes.At(t_i)+t_callbackList.At(t_i)->m_min_interval || t_animationTime<FLOAT(0.0) && t_animationTime<=m_m_lastCallbackTimes.At(t_i)-t_callbackList.At(t_i)->m_min_interval){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<95>");
			t_callbackList.At(t_i)->m_callback->p_AnimationUpdate(t_animationTime,t_model,t_model->p_getUserData());
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<96>");
			m_m_lastCallbackTimes.At(t_i)=t_animationTime;
		}
	}
}
int c_CalAnimation::p_getState(){
	DBG_ENTER("CalAnimation.getState")
	c_CalAnimation *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<53>");
	return m_m_state;
}
Float c_CalAnimation::p_getTime(){
	DBG_ENTER("CalAnimation.getTime")
	c_CalAnimation *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<57>");
	return m_m_time;
}
Float c_CalAnimation::p_getTimeFactor(){
	DBG_ENTER("CalAnimation.getTimeFactor")
	c_CalAnimation *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<77>");
	return m_m_timeFactor;
}
void c_CalAnimation::p_setTime(Float t_time){
	DBG_ENTER("CalAnimation.setTime")
	c_CalAnimation *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_time,"time")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<69>");
	m_m_time=t_time;
}
c_CalCoreAnimation* c_CalAnimation::p_getCoreAnimation2(){
	DBG_ENTER("CalAnimation.getCoreAnimation")
	c_CalAnimation *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<49>");
	return m_m_coreAnimation;
}
void c_CalAnimation::p_completeCallbacks(c_CalModel* t_model){
	DBG_ENTER("CalAnimation.completeCallbacks")
	c_CalAnimation *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_model,"model")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<102>");
	Array<c_CalCallbackRecord* > t_callbackList=m_m_coreAnimation->p_getCallbackList();
	DBG_LOCAL(t_callbackList,"callbackList")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<103>");
	for(int t_i=0;t_i<=t_callbackList.Length()-1;t_i=t_i+1){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<104>");
		t_callbackList.At(t_i)->m_callback->p_AnimationComplete(t_model,t_model->p_getUserData());
	}
}
Float c_CalAnimation::p_getWeight(){
	DBG_ENTER("CalAnimation.getWeight")
	c_CalAnimation *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<65>");
	return m_m_weight;
}
void c_CalAnimation::mark(){
	Object::mark();
	gc_mark_q(m_m_coreAnimation);
	gc_mark_q(m_m_lastCallbackTimes);
}
String c_CalAnimation::debug(){
	String t="(CalAnimation)\n";
	t+=dbg_decl("m_coreAnimation",&m_m_coreAnimation);
	t+=dbg_decl("m_lastCallbackTimes",&m_m_lastCallbackTimes);
	t+=dbg_decl("m_type",&m_m_type);
	t+=dbg_decl("m_state",&m_m_state);
	t+=dbg_decl("m_time",&m_m_time);
	t+=dbg_decl("m_timeFactor",&m_m_timeFactor);
	t+=dbg_decl("m_weight",&m_m_weight);
	return t;
}
c_CalAnimationAction::c_CalAnimationAction(){
	m_m_delayIn=FLOAT(.0);
	m_m_weightTarget=FLOAT(.0);
	m_m_autoLock=false;
	m_m_delayOut=FLOAT(.0);
}
bool c_CalAnimationAction::p_update(Float t_deltaTime){
	DBG_ENTER("CalAnimationAction.update")
	c_CalAnimationAction *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_deltaTime,"deltaTime")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<192>");
	if(p_getState()!=6){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<193>");
		p_setTime(p_getTime()+t_deltaTime*p_getTimeFactor());
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<197>");
	if(p_getState()==3){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<199>");
		if(p_getTime()<m_m_delayIn){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<200>");
			p_setWeight(p_getTime()/m_m_delayIn*m_m_weightTarget);
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<203>");
			p_setState(4);
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<204>");
			p_setWeight(m_m_weightTarget);
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<209>");
	if(p_getState()==4){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<211>");
		if(m_m_autoLock==false && p_getTime()>=p_getCoreAnimation2()->p_getDuration()-m_m_delayOut){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<212>");
			p_setState(5);
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<214>");
			if(m_m_autoLock==true && p_getTime()>p_getCoreAnimation2()->p_getDuration()){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<215>");
				p_setState(6);
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<216>");
				p_setTime(p_getCoreAnimation2()->p_getDuration());
			}
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<221>");
	if(p_getState()==5){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<223>");
		if(p_getTime()<p_getCoreAnimation2()->p_getDuration()){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<224>");
			p_setWeight((p_getCoreAnimation2()->p_getDuration()-p_getTime())/m_m_delayOut*m_m_weightTarget);
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<227>");
			p_setWeight(FLOAT(0.0));
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<228>");
			return false;
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<232>");
	return true;
}
void c_CalAnimationAction::mark(){
	c_CalAnimation::mark();
}
String c_CalAnimationAction::debug(){
	String t="(CalAnimationAction)\n";
	t=c_CalAnimation::debug()+t;
	t+=dbg_decl("m_delayIn",&m_m_delayIn);
	t+=dbg_decl("m_delayOut",&m_m_delayOut);
	t+=dbg_decl("m_weightTarget",&m_m_weightTarget);
	t+=dbg_decl("m_autoLock",&m_m_autoLock);
	return t;
}
c_CalAnimationCycle::c_CalAnimationCycle(){
	m_m_targetDelay=FLOAT(.0);
	m_m_targetWeight=FLOAT(.0);
}
c_CalAnimationCycle* c_CalAnimationCycle::m_new(){
	DBG_ENTER("CalAnimationCycle.new")
	c_CalAnimationCycle *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<246>");
	c_CalAnimation::m_new();
	return this;
}
c_CalAnimationCycle* c_CalAnimationCycle::m_new2(c_CalCoreAnimation* t_coreAnimation){
	DBG_ENTER("CalAnimationCycle.new")
	c_CalAnimationCycle *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_coreAnimation,"coreAnimation")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<252>");
	c_CalAnimation::m_new2(t_coreAnimation);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<253>");
	m_m_targetDelay=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<254>");
	m_m_targetWeight=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<256>");
	p_setType(1);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<257>");
	p_setState(1);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<259>");
	p_setWeight(FLOAT(0.0));
	return this;
}
bool c_CalAnimationCycle::p_blend3(Float t_weight,Float t_delay){
	DBG_ENTER("CalAnimationCycle.blend")
	c_CalAnimationCycle *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_weight,"weight")
	DBG_LOCAL(t_delay,"delay")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<264>");
	m_m_targetWeight=t_weight;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<265>");
	m_m_targetDelay=t_delay;
	return false;
}
bool c_CalAnimationCycle::p_update(Float t_deltaTime){
	DBG_ENTER("CalAnimationCycle.update")
	c_CalAnimationCycle *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_deltaTime,"deltaTime")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<286>");
	if(m_m_targetDelay<=bb_math2_Abs2(t_deltaTime)){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<288>");
		p_setWeight(m_m_targetWeight);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<289>");
		m_m_targetDelay=FLOAT(0.0);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<292>");
		if(p_getWeight()==FLOAT(0.0)){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<293>");
			return false;
		}
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<297>");
		Float t_factor=t_deltaTime/m_m_targetDelay;
		DBG_LOCAL(t_factor,"factor")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<298>");
		p_setWeight((FLOAT(1.0)-t_factor)*p_getWeight()+t_factor*m_m_targetWeight);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<299>");
		m_m_targetDelay-=t_deltaTime;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<303>");
	if(p_getState()==2){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<304>");
		p_setTime(p_getTime()+t_deltaTime*p_getTimeFactor());
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<305>");
		if(p_getTime()>=p_getCoreAnimation2()->p_getDuration()){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<306>");
			p_setTime(bb_animation_Modf(p_getTime(),p_getCoreAnimation2()->p_getDuration()));
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<308>");
		if(p_getTime()<FLOAT(0.0)){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<309>");
			p_setTime(p_getTime()+p_getCoreAnimation2()->p_getDuration());
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<313>");
	return true;
}
void c_CalAnimationCycle::mark(){
	c_CalAnimation::mark();
}
String c_CalAnimationCycle::debug(){
	String t="(CalAnimationCycle)\n";
	t=c_CalAnimation::debug()+t;
	t+=dbg_decl("m_targetDelay",&m_m_targetDelay);
	t+=dbg_decl("m_targetWeight",&m_m_targetWeight);
	return t;
}
c_CalMorphTargetMixer::c_CalMorphTargetMixer(){
	m_m_model=0;
	m_m_vectorCurrentWeight=Array<Float >();
	m_m_vectorEndWeight=Array<Float >();
	m_m_vectorDuration=Array<Float >();
}
c_CalMorphTargetMixer* c_CalMorphTargetMixer::m_new(){
	DBG_ENTER("CalMorphTargetMixer.new")
	c_CalMorphTargetMixer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/morphtargetmixer.monkey<12>");
	m_m_model=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/morphtargetmixer.monkey<13>");
	gc_assign(m_m_vectorCurrentWeight,Array<Float >(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/morphtargetmixer.monkey<14>");
	gc_assign(m_m_vectorEndWeight,Array<Float >(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/morphtargetmixer.monkey<15>");
	gc_assign(m_m_vectorDuration,Array<Float >(0));
	return this;
}
c_CalMorphTargetMixer* c_CalMorphTargetMixer::m_new2(c_CalModel* t_model){
	DBG_ENTER("CalMorphTargetMixer.new")
	c_CalMorphTargetMixer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_model,"model")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/morphtargetmixer.monkey<21>");
	gc_assign(m_m_model,t_model);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/morphtargetmixer.monkey<22>");
	int t_morphAnimationCount=t_model->p_getCoreModel()->p_getCoreMorphAnimationCount();
	DBG_LOCAL(t_morphAnimationCount,"morphAnimationCount")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/morphtargetmixer.monkey<23>");
	gc_assign(m_m_vectorCurrentWeight,Array<Float >(t_morphAnimationCount));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/morphtargetmixer.monkey<24>");
	gc_assign(m_m_vectorEndWeight,Array<Float >(t_morphAnimationCount));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/morphtargetmixer.monkey<25>");
	gc_assign(m_m_vectorDuration,Array<Float >(t_morphAnimationCount));
	return this;
}
void c_CalMorphTargetMixer::p_update(Float t_deltaTime){
	DBG_ENTER("CalMorphTargetMixer.update")
	c_CalMorphTargetMixer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_deltaTime,"deltaTime")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/morphtargetmixer.monkey<80>");
	for(int t_i=0;t_i<=m_m_vectorCurrentWeight.Length()-1;t_i=t_i+1){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/morphtargetmixer.monkey<81>");
		Float t_currentWeight=m_m_vectorCurrentWeight.At(t_i);
		DBG_LOCAL(t_currentWeight,"currentWeight")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/morphtargetmixer.monkey<82>");
		Float t_endWeight=m_m_vectorEndWeight.At(t_i);
		DBG_LOCAL(t_endWeight,"endWeight")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/morphtargetmixer.monkey<83>");
		Float t_duration=m_m_vectorDuration.At(t_i);
		DBG_LOCAL(t_duration,"duration")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/morphtargetmixer.monkey<85>");
		if(t_deltaTime>=t_duration){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/morphtargetmixer.monkey<86>");
			m_m_vectorCurrentWeight.At(t_i)=t_endWeight;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/morphtargetmixer.monkey<87>");
			m_m_vectorDuration.At(t_i)=FLOAT(0.0);
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/morphtargetmixer.monkey<89>");
			m_m_vectorCurrentWeight.At(t_i)+=(t_endWeight-t_currentWeight)*t_deltaTime/t_duration;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/morphtargetmixer.monkey<90>");
			m_m_vectorDuration.At(t_i)-=t_deltaTime;
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/morphtargetmixer.monkey<94>");
	for(int t_morphAnimationID=0;t_morphAnimationID<=m_m_vectorCurrentWeight.Length()-1;t_morphAnimationID=t_morphAnimationID+1){
		DBG_BLOCK();
		DBG_LOCAL(t_morphAnimationID,"morphAnimationID")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/morphtargetmixer.monkey<95>");
		c_CalCoreMorphAnimation* t_coreMorphAnimation=m_m_model->p_getCoreModel()->p_getCoreMorphAnimation(t_morphAnimationID);
		DBG_LOCAL(t_coreMorphAnimation,"coreMorphAnimation")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/morphtargetmixer.monkey<97>");
		Array<int > t_vectorCoreMeshID=t_coreMorphAnimation->p_getVectorCoreMeshID();
		DBG_LOCAL(t_vectorCoreMeshID,"vectorCoreMeshID")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/morphtargetmixer.monkey<98>");
		Array<int > t_vectorMorphTargetID=t_coreMorphAnimation->p_getVectorMorphTargetID();
		DBG_LOCAL(t_vectorMorphTargetID,"vectorMorphTargetID")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/morphtargetmixer.monkey<100>");
		for(int t_i2=0;t_i2<=t_vectorCoreMeshID.Length()-1;t_i2=t_i2+1){
			DBG_BLOCK();
			DBG_LOCAL(t_i2,"i")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/morphtargetmixer.monkey<101>");
			Array<c_CalSubmesh* > t_vectorSubmesh=m_m_model->p_getMesh(t_vectorCoreMeshID.At(t_i2))->p_getVectorSubmesh();
			DBG_LOCAL(t_vectorSubmesh,"vectorSubmesh")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/morphtargetmixer.monkey<103>");
			int t_submeshCount=t_vectorSubmesh.Length();
			DBG_LOCAL(t_submeshCount,"submeshCount")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/morphtargetmixer.monkey<104>");
			for(int t_submeshId=0;t_submeshId<=t_submeshCount-1;t_submeshId=t_submeshId+1){
				DBG_BLOCK();
				DBG_LOCAL(t_submeshId,"submeshId")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/morphtargetmixer.monkey<105>");
				t_vectorSubmesh.At(t_submeshId)->p_setMorphTargetWeight(t_vectorMorphTargetID.At(t_i2),m_m_vectorCurrentWeight.At(t_morphAnimationID));
			}
		}
	}
}
void c_CalMorphTargetMixer::mark(){
	Object::mark();
	gc_mark_q(m_m_model);
	gc_mark_q(m_m_vectorCurrentWeight);
	gc_mark_q(m_m_vectorEndWeight);
	gc_mark_q(m_m_vectorDuration);
}
String c_CalMorphTargetMixer::debug(){
	String t="(CalMorphTargetMixer)\n";
	t+=dbg_decl("m_model",&m_m_model);
	t+=dbg_decl("m_vectorCurrentWeight",&m_m_vectorCurrentWeight);
	t+=dbg_decl("m_vectorEndWeight",&m_m_vectorEndWeight);
	t+=dbg_decl("m_vectorDuration",&m_m_vectorDuration);
	return t;
}
c_CalPhysique::c_CalPhysique(){
	m_m_model=0;
	m_m_normalize=false;
	m_m_axisFactorX=FLOAT(.0);
	m_m_axisFactorY=FLOAT(.0);
	m_m_axisFactorZ=FLOAT(.0);
}
c_CalPhysique* c_CalPhysique::m_new(){
	DBG_ENTER("CalPhysique.new")
	c_CalPhysique *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<12>");
	m_m_model=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<13>");
	m_m_normalize=false;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<14>");
	m_m_axisFactorX=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<15>");
	m_m_axisFactorY=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<16>");
	m_m_axisFactorZ=FLOAT(0.0);
	return this;
}
c_CalPhysique* c_CalPhysique::m_new2(c_CalModel* t_model){
	DBG_ENTER("CalPhysique.new")
	c_CalPhysique *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_model,"model")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<20>");
	gc_assign(m_m_model,t_model);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<21>");
	m_m_normalize=true;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<22>");
	m_m_axisFactorX=FLOAT(1.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<23>");
	m_m_axisFactorY=FLOAT(1.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<24>");
	m_m_axisFactorZ=FLOAT(1.0);
	return this;
}
int c_CalPhysique::p_calculateVertices(c_CalSubmesh* t_submesh,Array<Float > t_vertexBuffer,int t_stride){
	DBG_ENTER("CalPhysique.calculateVertices")
	c_CalPhysique *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_submesh,"submesh")
	DBG_LOCAL(t_vertexBuffer,"vertexBuffer")
	DBG_LOCAL(t_stride,"stride")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<224>");
	if(t_stride<=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<225>");
		t_stride=3;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<228>");
	if(t_vertexBuffer.Length()<t_submesh->p_getVertexCount()*t_stride){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<229>");
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<233>");
	Array<c_CalBone* > t_vectorBone=m_m_model->p_getSkeleton()->p_getVectorBone();
	DBG_LOCAL(t_vectorBone,"vectorBone")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<236>");
	Array<c_CalVertex* > t_vectorVertex=t_submesh->p_getCoreSubmesh2()->p_getVectorVertex();
	DBG_LOCAL(t_vectorVertex,"vectorVertex")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<239>");
	Array<c_CalPhysicalProperty* > t_vectorPhysicalProperty=t_submesh->p_getCoreSubmesh2()->p_getVectorPhysicalProperty();
	DBG_LOCAL(t_vectorPhysicalProperty,"vectorPhysicalProperty")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<242>");
	int t_vertexCount=t_submesh->p_getVertexCount();
	DBG_LOCAL(t_vertexCount,"vertexCount")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<245>");
	Array<c_CalCoreSubMorphTarget* > t_vectorSubMorphTarget=t_submesh->p_getCoreSubmesh2()->p_getVectorCoreSubMorphTarget();
	DBG_LOCAL(t_vectorSubMorphTarget,"vectorSubMorphTarget")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<248>");
	Float t_baseWeight=t_submesh->p_getBaseWeight();
	DBG_LOCAL(t_baseWeight,"baseWeight")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<251>");
	int t_morphTargetCount=t_submesh->p_getMorphTargetWeightCount();
	DBG_LOCAL(t_morphTargetCount,"morphTargetCount")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<254>");
	int t_vi=0;
	DBG_LOCAL(t_vi,"vi")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<255>");
	c_CalVector* t_position=(new c_CalVector)->m_new();
	DBG_LOCAL(t_position,"position")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<256>");
	c_CalVector* t_v=(new c_CalVector)->m_new();
	DBG_LOCAL(t_v,"v")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<257>");
	for(int t_vertexId=0;t_vertexId<=t_vertexCount-1;t_vertexId=t_vertexId+1){
		DBG_BLOCK();
		DBG_LOCAL(t_vertexId,"vertexId")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<259>");
		c_CalVertex* t_vertex=t_vectorVertex.At(t_vertexId);
		DBG_LOCAL(t_vertex,"vertex")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<262>");
		t_position->p_assign3(FLOAT(0.0),FLOAT(0.0),FLOAT(0.0));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<263>");
		if(t_baseWeight==FLOAT(1.0)){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<264>");
			t_position->m_x=t_vertex->m_position->m_x;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<265>");
			t_position->m_y=t_vertex->m_position->m_y;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<266>");
			t_position->m_z=t_vertex->m_position->m_z;
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<268>");
			t_position->m_x=t_baseWeight*t_vertex->m_position->m_x;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<269>");
			t_position->m_y=t_baseWeight*t_vertex->m_position->m_y;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<270>");
			t_position->m_z=t_baseWeight*t_vertex->m_position->m_z;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<272>");
			for(int t_morphTargetId=0;t_morphTargetId<=t_morphTargetCount-1;t_morphTargetId=t_morphTargetId+1){
				DBG_BLOCK();
				DBG_LOCAL(t_morphTargetId,"morphTargetId")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<273>");
				c_CalBlendVertex* t_blendVertex=t_vectorSubMorphTarget.At(t_morphTargetId)->p_getVectorBlendVertex().At(t_vertexId);
				DBG_LOCAL(t_blendVertex,"blendVertex")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<274>");
				Float t_currentWeight=t_submesh->p_getMorphTargetWeight(t_morphTargetId);
				DBG_LOCAL(t_currentWeight,"currentWeight")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<275>");
				t_position->m_x+=t_currentWeight*t_blendVertex->m_position->m_x;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<276>");
				t_position->m_y+=t_currentWeight*t_blendVertex->m_position->m_y;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<277>");
				t_position->m_z+=t_currentWeight*t_blendVertex->m_position->m_z;
			}
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<282>");
		Float t_x=FLOAT(.0);
		Float t_y=FLOAT(.0);
		Float t_z=FLOAT(.0);
		DBG_LOCAL(t_x,"x")
		DBG_LOCAL(t_y,"y")
		DBG_LOCAL(t_z,"z")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<283>");
		t_x=FLOAT(0.0);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<284>");
		t_y=FLOAT(0.0);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<285>");
		t_z=FLOAT(0.0);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<288>");
		int t_influenceCount=t_vertex->m_vectorInfluence.Length();
		DBG_LOCAL(t_influenceCount,"influenceCount")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<289>");
		if(t_influenceCount==0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<290>");
			t_x=t_position->m_x;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<291>");
			t_y=t_position->m_y;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<292>");
			t_z=t_position->m_z;
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<294>");
			for(int t_influenceId=0;t_influenceId<=t_influenceCount-1;t_influenceId=t_influenceId+1){
				DBG_BLOCK();
				DBG_LOCAL(t_influenceId,"influenceId")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<296>");
				c_CalInfluence* t_influence=t_vertex->m_vectorInfluence.At(t_influenceId);
				DBG_LOCAL(t_influence,"influence")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<299>");
				c_CalBone* t_bone=t_vectorBone.At(t_influence->m_boneId);
				DBG_LOCAL(t_bone,"bone")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<302>");
				t_v->p_assign4(t_position);
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<303>");
				t_v->p_multMatrixLocal(t_bone->p_getTransformMatrix());
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<304>");
				t_v->p_addLocal(t_bone->p_getTranslationBoneSpace());
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<306>");
				t_x+=t_influence->m_weight*t_v->m_x;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<307>");
				t_y+=t_influence->m_weight*t_v->m_y;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<308>");
				t_z+=t_influence->m_weight*t_v->m_z;
			}
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<313>");
		if(t_submesh->p_getCoreSubmesh2()->p_getSpringCount()>0 && t_submesh->p_hasInternalData()){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<315>");
			c_CalPhysicalProperty* t_physicalProperty=t_vectorPhysicalProperty.At(t_vertexId);
			DBG_LOCAL(t_physicalProperty,"physicalProperty")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<318>");
			if(t_physicalProperty->m_weight==FLOAT(0.0)){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<319>");
				t_vertexBuffer.At(t_vi)=t_x*m_m_axisFactorX;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<320>");
				t_vertexBuffer.At(t_vi+1)=t_y*m_m_axisFactorY;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<321>");
				t_vertexBuffer.At(t_vi+2)=t_z*m_m_axisFactorZ;
			}
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<324>");
			t_vertexBuffer.At(t_vi)=t_x*m_m_axisFactorX;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<325>");
			t_vertexBuffer.At(t_vi+1)=t_y*m_m_axisFactorY;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<326>");
			t_vertexBuffer.At(t_vi+2)=t_z*m_m_axisFactorZ;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<329>");
		t_vi+=t_stride;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<332>");
	return t_vertexCount;
}
int c_CalPhysique::p_calculateVerticesAndNormalsInternal(c_CalSubmesh* t_submesh,Array<c_CalVector* > t_veritces,Array<c_CalVector* > t_normals){
	DBG_ENTER("CalPhysique.calculateVerticesAndNormalsInternal")
	c_CalPhysique *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_submesh,"submesh")
	DBG_LOCAL(t_veritces,"veritces")
	DBG_LOCAL(t_normals,"normals")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<806>");
	if(t_veritces.Length()<t_submesh->p_getVertexCount() || t_normals.Length()<t_submesh->p_getVertexCount()){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<807>");
		bbPrint(String(L"internal error: buffer is not large enough to contain all the vertex/normal data",80));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<808>");
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<811>");
	Array<c_CalBone* > t_vectorBone=m_m_model->p_getSkeleton()->p_getVectorBone();
	DBG_LOCAL(t_vectorBone,"vectorBone")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<814>");
	Array<c_CalVertex* > t_vectorVertex=t_submesh->p_getCoreSubmesh2()->p_getVectorVertex();
	DBG_LOCAL(t_vectorVertex,"vectorVertex")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<817>");
	Array<c_CalPhysicalProperty* > t_vectorPhysicalProperty=t_submesh->p_getCoreSubmesh2()->p_getVectorPhysicalProperty();
	DBG_LOCAL(t_vectorPhysicalProperty,"vectorPhysicalProperty")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<820>");
	int t_vertexCount=t_submesh->p_getVertexCount();
	DBG_LOCAL(t_vertexCount,"vertexCount")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<823>");
	Array<c_CalCoreSubMorphTarget* > t_vectorSubMorphTarget=t_submesh->p_getCoreSubmesh2()->p_getVectorCoreSubMorphTarget();
	DBG_LOCAL(t_vectorSubMorphTarget,"vectorSubMorphTarget")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<826>");
	Float t_baseWeight=t_submesh->p_getBaseWeight();
	DBG_LOCAL(t_baseWeight,"baseWeight")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<829>");
	int t_morphTargetCount=t_submesh->p_getMorphTargetWeightCount();
	DBG_LOCAL(t_morphTargetCount,"morphTargetCount")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<832>");
	c_CalVector* t_v=(new c_CalVector)->m_new();
	DBG_LOCAL(t_v,"v")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<833>");
	c_CalVector* t_n=(new c_CalVector)->m_new();
	DBG_LOCAL(t_n,"n")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<834>");
	c_CalVector* t_position=(new c_CalVector)->m_new();
	DBG_LOCAL(t_position,"position")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<835>");
	c_CalVector* t_normal=(new c_CalVector)->m_new();
	DBG_LOCAL(t_normal,"normal")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<836>");
	for(int t_vertexId=0;t_vertexId<=t_vertexCount-1;t_vertexId=t_vertexId+1){
		DBG_BLOCK();
		DBG_LOCAL(t_vertexId,"vertexId")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<838>");
		c_CalVertex* t_vertex=t_vectorVertex.At(t_vertexId);
		DBG_LOCAL(t_vertex,"vertex")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<841>");
		t_position->p_assign3(FLOAT(0.0),FLOAT(0.0),FLOAT(0.0));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<842>");
		t_normal->p_assign3(FLOAT(0.0),FLOAT(0.0),FLOAT(0.0));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<843>");
		if(t_baseWeight==FLOAT(1.0)){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<844>");
			t_position->m_x=t_vertex->m_position->m_x;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<845>");
			t_position->m_y=t_vertex->m_position->m_y;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<846>");
			t_position->m_z=t_vertex->m_position->m_z;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<847>");
			t_normal->m_x=t_vertex->m_normal->m_x;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<848>");
			t_normal->m_y=t_vertex->m_normal->m_y;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<849>");
			t_normal->m_z=t_vertex->m_normal->m_z;
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<851>");
			t_position->m_x=t_baseWeight*t_vertex->m_position->m_x;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<852>");
			t_position->m_y=t_baseWeight*t_vertex->m_position->m_y;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<853>");
			t_position->m_z=t_baseWeight*t_vertex->m_position->m_z;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<854>");
			t_normal->m_x=t_baseWeight*t_vertex->m_normal->m_x;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<855>");
			t_normal->m_y=t_baseWeight*t_vertex->m_normal->m_y;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<856>");
			t_normal->m_z=t_baseWeight*t_vertex->m_normal->m_z;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<858>");
			for(int t_morphTargetId=0;t_morphTargetId<=t_morphTargetCount-1;t_morphTargetId=t_morphTargetId+1){
				DBG_BLOCK();
				DBG_LOCAL(t_morphTargetId,"morphTargetId")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<859>");
				c_CalBlendVertex* t_blendVertex=t_vectorSubMorphTarget.At(t_morphTargetId)->p_getVectorBlendVertex().At(t_vertexId);
				DBG_LOCAL(t_blendVertex,"blendVertex")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<860>");
				Float t_currentWeight=t_submesh->p_getMorphTargetWeight(t_morphTargetId);
				DBG_LOCAL(t_currentWeight,"currentWeight")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<861>");
				t_position->m_x+=t_currentWeight*t_blendVertex->m_position->m_x;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<862>");
				t_position->m_y+=t_currentWeight*t_blendVertex->m_position->m_y;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<863>");
				t_position->m_z+=t_currentWeight*t_blendVertex->m_position->m_z;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<864>");
				t_normal->m_x+=t_currentWeight*t_blendVertex->m_normal->m_x;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<865>");
				t_normal->m_y+=t_currentWeight*t_blendVertex->m_normal->m_y;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<866>");
				t_normal->m_z+=t_currentWeight*t_blendVertex->m_normal->m_z;
			}
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<871>");
		Float t_x=FLOAT(.0);
		Float t_y=FLOAT(.0);
		Float t_z=FLOAT(.0);
		DBG_LOCAL(t_x,"x")
		DBG_LOCAL(t_y,"y")
		DBG_LOCAL(t_z,"z")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<872>");
		t_x=FLOAT(0.0);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<873>");
		t_y=FLOAT(0.0);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<874>");
		t_z=FLOAT(0.0);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<877>");
		Float t_nx=FLOAT(.0);
		Float t_ny=FLOAT(.0);
		Float t_nz=FLOAT(.0);
		DBG_LOCAL(t_nx,"nx")
		DBG_LOCAL(t_ny,"ny")
		DBG_LOCAL(t_nz,"nz")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<878>");
		t_nx=FLOAT(0.0);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<879>");
		t_ny=FLOAT(0.0);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<880>");
		t_nz=FLOAT(0.0);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<883>");
		int t_influenceCount=t_vertex->m_vectorInfluence.Length();
		DBG_LOCAL(t_influenceCount,"influenceCount")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<884>");
		if(t_influenceCount==0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<885>");
			t_x=t_position->m_x;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<886>");
			t_y=t_position->m_y;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<887>");
			t_z=t_position->m_z;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<888>");
			t_nx=t_normal->m_x;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<889>");
			t_ny=t_normal->m_y;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<890>");
			t_nz=t_normal->m_z;
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<892>");
			for(int t_influenceId=0;t_influenceId<=t_influenceCount-1;t_influenceId=t_influenceId+1){
				DBG_BLOCK();
				DBG_LOCAL(t_influenceId,"influenceId")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<894>");
				c_CalInfluence* t_influence=t_vertex->m_vectorInfluence.At(t_influenceId);
				DBG_LOCAL(t_influence,"influence")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<897>");
				c_CalBone* t_bone=t_vectorBone.At(t_influence->m_boneId);
				DBG_LOCAL(t_bone,"bone")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<900>");
				t_v->p_assign4(t_position);
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<901>");
				t_v->p_multMatrixLocal(t_bone->p_getTransformMatrix());
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<902>");
				t_v->p_addLocal(t_bone->p_getTranslationBoneSpace());
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<904>");
				t_x+=t_influence->m_weight*t_v->m_x;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<905>");
				t_y+=t_influence->m_weight*t_v->m_y;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<906>");
				t_z+=t_influence->m_weight*t_v->m_z;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<909>");
				t_n->p_assign4(t_normal);
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<910>");
				t_n->p_multMatrixLocal(t_bone->p_getTransformMatrix());
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<912>");
				t_nx+=t_influence->m_weight*t_n->m_x;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<913>");
				t_ny+=t_influence->m_weight*t_n->m_y;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<914>");
				t_nz+=t_influence->m_weight*t_n->m_z;
			}
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<918>");
		if(t_veritces.At(t_vertexId)==0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<919>");
			gc_assign(t_veritces.At(t_vertexId),(new c_CalVector)->m_new());
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<921>");
		if(t_normals.At(t_vertexId)==0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<922>");
			gc_assign(t_normals.At(t_vertexId),(new c_CalVector)->m_new());
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<926>");
		if(t_submesh->p_getCoreSubmesh2()->p_getSpringCount()>0 && t_submesh->p_hasInternalData()){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<928>");
			c_CalPhysicalProperty* t_physicalProperty=t_vectorPhysicalProperty.At(t_vertexId);
			DBG_LOCAL(t_physicalProperty,"physicalProperty")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<931>");
			if(t_physicalProperty->m_weight==FLOAT(0.0)){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<932>");
				t_veritces.At(t_vertexId)->p_assign3(t_x*m_m_axisFactorX,t_y*m_m_axisFactorY,t_z*m_m_axisFactorZ);
			}
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<935>");
			t_veritces.At(t_vertexId)->p_assign3(t_x*m_m_axisFactorX,t_y*m_m_axisFactorY,t_z*m_m_axisFactorZ);
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<939>");
		if(m_m_normalize==true){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<940>");
			t_nx/=m_m_axisFactorX;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<941>");
			t_ny/=m_m_axisFactorY;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<942>");
			t_nz/=m_m_axisFactorZ;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<944>");
			Float t_scale=FLOAT(1.0)/(Float)sqrt(t_nx*t_nx+t_ny*t_ny+t_nz*t_nz);
			DBG_LOCAL(t_scale,"scale")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<946>");
			t_normals.At(t_vertexId)->p_assign3(t_nx*t_scale,t_ny*t_scale,t_nz*t_scale);
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<948>");
			t_normals.At(t_vertexId)->p_assign3(t_nx,t_ny,t_nz);
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<952>");
	return t_vertexCount;
}
int c_CalPhysique::p_calculateTangentSpacesInternal(c_CalSubmesh* t_submesh,int t_mapId,Array<c_CalTangentSpace* > t_tangentSpaces){
	DBG_ENTER("CalPhysique.calculateTangentSpacesInternal")
	c_CalPhysique *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_submesh,"submesh")
	DBG_LOCAL(t_mapId,"mapId")
	DBG_LOCAL(t_tangentSpaces,"tangentSpaces")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<957>");
	if(t_mapId<0 || t_mapId>=t_submesh->p_getCoreSubmesh2()->p_getVectorVectorTangentSpace().Length()){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<958>");
		bbPrint(String(L"internal error: mapId is out of range",37));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<959>");
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<962>");
	if(t_tangentSpaces.Length()<t_submesh->p_getVertexCount()){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<963>");
		bbPrint(String(L"internal error: buffer is not large enough to contain all the tangent space data",80));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<964>");
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<968>");
	Array<c_CalBone* > t_vectorBone=m_m_model->p_getSkeleton()->p_getVectorBone();
	DBG_LOCAL(t_vectorBone,"vectorBone")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<971>");
	Array<c_CalVertex* > t_vectorVertex=t_submesh->p_getCoreSubmesh2()->p_getVectorVertex();
	DBG_LOCAL(t_vectorVertex,"vectorVertex")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<974>");
	Array<c_CalTangentSpace* > t_vectorTangentSpace=t_submesh->p_getCoreSubmesh2()->p_getVectorVectorTangentSpace().At(t_mapId);
	DBG_LOCAL(t_vectorTangentSpace,"vectorTangentSpace")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<977>");
	int t_vertexCount=t_submesh->p_getVertexCount();
	DBG_LOCAL(t_vertexCount,"vertexCount")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<980>");
	c_CalVector* t_v=(new c_CalVector)->m_new();
	DBG_LOCAL(t_v,"v")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<981>");
	for(int t_vertexId=0;t_vertexId<=t_vertexCount-1;t_vertexId=t_vertexId+1){
		DBG_BLOCK();
		DBG_LOCAL(t_vertexId,"vertexId")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<982>");
		c_CalTangentSpace* t_tangentSpace=t_vectorTangentSpace.At(t_vertexId);
		DBG_LOCAL(t_tangentSpace,"tangentSpace")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<985>");
		c_CalVertex* t_vertex=t_vectorVertex.At(t_vertexId);
		DBG_LOCAL(t_vertex,"vertex")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<988>");
		Float t_tx=FLOAT(.0);
		Float t_ty=FLOAT(.0);
		Float t_tz=FLOAT(.0);
		DBG_LOCAL(t_tx,"tx")
		DBG_LOCAL(t_ty,"ty")
		DBG_LOCAL(t_tz,"tz")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<989>");
		t_tx=FLOAT(0.0);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<990>");
		t_ty=FLOAT(0.0);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<991>");
		t_tz=FLOAT(0.0);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<994>");
		int t_influenceCount=t_vertex->m_vectorInfluence.Length();
		DBG_LOCAL(t_influenceCount,"influenceCount")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<995>");
		for(int t_influenceId=0;t_influenceId<=t_influenceCount-1;t_influenceId=t_influenceId+1){
			DBG_BLOCK();
			DBG_LOCAL(t_influenceId,"influenceId")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<997>");
			c_CalInfluence* t_influence=t_vertex->m_vectorInfluence.At(t_influenceId);
			DBG_LOCAL(t_influence,"influence")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<1000>");
			c_CalBone* t_bone=t_vectorBone.At(t_influence->m_boneId);
			DBG_LOCAL(t_bone,"bone")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<1003>");
			t_v->p_assign4(t_tangentSpace->m_tangent);
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<1004>");
			t_v->p_multMatrixLocal(t_bone->p_getTransformMatrix());
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<1006>");
			t_tx+=t_influence->m_weight*t_v->m_x;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<1007>");
			t_ty+=t_influence->m_weight*t_v->m_y;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<1008>");
			t_tz+=t_influence->m_weight*t_v->m_z;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<1011>");
		if(t_tangentSpaces.At(t_vertexId)==0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<1012>");
			gc_assign(t_tangentSpaces.At(t_vertexId),(new c_CalTangentSpace)->m_new());
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<1015>");
		if(m_m_normalize==true){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<1016>");
			t_tx/=m_m_axisFactorX;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<1017>");
			t_ty/=m_m_axisFactorY;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<1018>");
			t_tz/=m_m_axisFactorZ;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<1020>");
			Float t_scale=FLOAT(1.0)/(Float)sqrt(t_tx*t_tx+t_ty*t_ty+t_tz*t_tz);
			DBG_LOCAL(t_scale,"scale")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<1022>");
			t_tangentSpaces.At(t_vertexId)->m_tangent->p_assign3(t_tx*t_scale,t_ty*t_scale,t_tz*t_scale);
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<1024>");
			t_tangentSpaces.At(t_vertexId)->m_tangent->p_assign3(t_tx,t_ty,t_tz);
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<1027>");
		t_tangentSpaces.At(t_vertexId)->m_crossFactor=t_tangentSpace->m_crossFactor;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<1030>");
	return t_vertexCount;
}
void c_CalPhysique::p_update2(){
	DBG_ENTER("CalPhysique.update")
	c_CalPhysique *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<754>");
	Array<c_CalMesh* > t_vectorMesh=m_m_model->p_getVectorMesh();
	DBG_LOCAL(t_vectorMesh,"vectorMesh")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<757>");
	for(int t_meshId=0;t_meshId<=t_vectorMesh.Length()-1;t_meshId=t_meshId+1){
		DBG_BLOCK();
		DBG_LOCAL(t_meshId,"meshId")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<759>");
		Array<c_CalSubmesh* > t_vectorSubmesh=t_vectorMesh.At(t_meshId)->p_getVectorSubmesh();
		DBG_LOCAL(t_vectorSubmesh,"vectorSubmesh")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<762>");
		for(int t_submeshId=0;t_submeshId<=t_vectorSubmesh.Length()-1;t_submeshId=t_submeshId+1){
			DBG_BLOCK();
			DBG_LOCAL(t_submeshId,"submeshId")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<763>");
			c_CalSubmesh* t_submesh=t_vectorSubmesh.At(t_submeshId);
			DBG_LOCAL(t_submesh,"submesh")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<765>");
			if(t_submesh->p_hasInternalData()==true){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<767>");
				Array<c_CalVector* > t_vectorVertex=t_submesh->p_getVectorVertex();
				DBG_LOCAL(t_vectorVertex,"vectorVertex")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<768>");
				Array<c_CalVector* > t_vectorNormal=t_submesh->p_getVectorNormal();
				DBG_LOCAL(t_vectorNormal,"vectorNormal")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<769>");
				p_calculateVerticesAndNormalsInternal(t_submesh,t_vectorVertex,t_vectorNormal);
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<771>");
				int t_vectorTangentSpaceCount=t_submesh->p_getVectorVectorTangentSpace().Length();
				DBG_LOCAL(t_vectorTangentSpaceCount,"vectorTangentSpaceCount")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<772>");
				for(int t_mapId=0;t_mapId<=t_vectorTangentSpaceCount-1;t_mapId=t_mapId+1){
					DBG_BLOCK();
					DBG_LOCAL(t_mapId,"mapId")
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<773>");
					if(t_submesh->p_isTangentsEnabled(t_mapId)==true){
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<774>");
						Array<c_CalTangentSpace* > t_vectorTangentSpace=t_submesh->p_getVectorVectorTangentSpace().At(t_mapId);
						DBG_LOCAL(t_vectorTangentSpace,"vectorTangentSpace")
						DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<775>");
						p_calculateTangentSpacesInternal(t_submesh,t_mapId,t_vectorTangentSpace);
					}
				}
			}
		}
	}
}
int c_CalPhysique::p_calculateVerticesNormalsAndTexCoords(c_CalSubmesh* t_submesh,Array<Float > t_vertexBuffer,int t_numTexCoords){
	DBG_ENTER("CalPhysique.calculateVerticesNormalsAndTexCoords")
	c_CalPhysique *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_submesh,"submesh")
	DBG_LOCAL(t_vertexBuffer,"vertexBuffer")
	DBG_LOCAL(t_numTexCoords,"numTexCoords")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<576>");
	if(t_numTexCoords<0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<577>");
		t_numTexCoords=0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<580>");
	Array<c_CalBone* > t_vectorBone=m_m_model->p_getSkeleton()->p_getVectorBone();
	DBG_LOCAL(t_vectorBone,"vectorBone")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<583>");
	Array<c_CalVertex* > t_vectorVertex=t_submesh->p_getCoreSubmesh2()->p_getVectorVertex();
	DBG_LOCAL(t_vectorVertex,"vectorVertex")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<586>");
	Array<Array<c_CalTextureCoordinate* > > t_vectorvectorTextureCoordinate=t_submesh->p_getCoreSubmesh2()->p_getVectorVectorTextureCoordinate();
	DBG_LOCAL(t_vectorvectorTextureCoordinate,"vectorvectorTextureCoordinate")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<588>");
	int t_textureCoordinateCount=t_vectorvectorTextureCoordinate.Length();
	DBG_LOCAL(t_textureCoordinateCount,"textureCoordinateCount")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<591>");
	if(t_numTexCoords<0 || t_numTexCoords>t_textureCoordinateCount){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<592>");
		if(t_textureCoordinateCount!=0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<593>");
			return -1;
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<598>");
	Array<c_CalPhysicalProperty* > t_vectorPhysicalProperty=t_submesh->p_getCoreSubmesh2()->p_getVectorPhysicalProperty();
	DBG_LOCAL(t_vectorPhysicalProperty,"vectorPhysicalProperty")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<601>");
	int t_vertexCount=t_submesh->p_getVertexCount();
	DBG_LOCAL(t_vertexCount,"vertexCount")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<604>");
	Array<c_CalCoreSubMorphTarget* > t_vectorSubMorphTarget=t_submesh->p_getCoreSubmesh2()->p_getVectorCoreSubMorphTarget();
	DBG_LOCAL(t_vectorSubMorphTarget,"vectorSubMorphTarget")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<607>");
	Float t_baseWeight=t_submesh->p_getBaseWeight();
	DBG_LOCAL(t_baseWeight,"baseWeight")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<610>");
	int t_morphTargetCount=t_submesh->p_getMorphTargetWeightCount();
	DBG_LOCAL(t_morphTargetCount,"morphTargetCount")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<613>");
	int t_vi=0;
	DBG_LOCAL(t_vi,"vi")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<614>");
	c_CalVector* t_position=(new c_CalVector)->m_new();
	DBG_LOCAL(t_position,"position")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<615>");
	c_CalVector* t_normal=(new c_CalVector)->m_new();
	DBG_LOCAL(t_normal,"normal")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<616>");
	for(int t_vertexId=0;t_vertexId<=t_vertexCount-1;t_vertexId=t_vertexId+1){
		DBG_BLOCK();
		DBG_LOCAL(t_vertexId,"vertexId")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<618>");
		c_CalVertex* t_vertex=t_vectorVertex.At(t_vertexId);
		DBG_LOCAL(t_vertex,"vertex")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<621>");
		t_position->p_assign3(FLOAT(0.0),FLOAT(0.0),FLOAT(0.0));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<622>");
		t_normal->p_assign3(FLOAT(0.0),FLOAT(0.0),FLOAT(0.0));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<623>");
		if(t_baseWeight==FLOAT(1.0)){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<624>");
			t_position->m_x=t_vertex->m_position->m_x;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<625>");
			t_position->m_y=t_vertex->m_position->m_y;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<626>");
			t_position->m_z=t_vertex->m_position->m_z;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<627>");
			t_normal->m_x=t_vertex->m_normal->m_x;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<628>");
			t_normal->m_y=t_vertex->m_normal->m_y;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<629>");
			t_normal->m_z=t_vertex->m_normal->m_z;
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<631>");
			t_position->m_x=t_baseWeight*t_vertex->m_position->m_x;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<632>");
			t_position->m_y=t_baseWeight*t_vertex->m_position->m_y;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<633>");
			t_position->m_z=t_baseWeight*t_vertex->m_position->m_z;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<634>");
			t_normal->m_x=t_baseWeight*t_vertex->m_normal->m_x;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<635>");
			t_normal->m_y=t_baseWeight*t_vertex->m_normal->m_y;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<636>");
			t_normal->m_z=t_baseWeight*t_vertex->m_normal->m_z;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<638>");
			for(int t_morphTargetId=0;t_morphTargetId<=t_morphTargetCount-1;t_morphTargetId=t_morphTargetId+1){
				DBG_BLOCK();
				DBG_LOCAL(t_morphTargetId,"morphTargetId")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<639>");
				c_CalBlendVertex* t_blendVertex=t_vectorSubMorphTarget.At(t_morphTargetId)->p_getVectorBlendVertex().At(t_vertexId);
				DBG_LOCAL(t_blendVertex,"blendVertex")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<640>");
				Float t_currentWeight=t_submesh->p_getMorphTargetWeight(t_morphTargetId);
				DBG_LOCAL(t_currentWeight,"currentWeight")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<641>");
				t_position->m_x+=t_currentWeight*t_blendVertex->m_position->m_x;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<642>");
				t_position->m_y+=t_currentWeight*t_blendVertex->m_position->m_y;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<643>");
				t_position->m_z+=t_currentWeight*t_blendVertex->m_position->m_z;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<644>");
				t_normal->m_x+=t_currentWeight*t_blendVertex->m_normal->m_x;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<645>");
				t_normal->m_y+=t_currentWeight*t_blendVertex->m_normal->m_y;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<646>");
				t_normal->m_z+=t_currentWeight*t_blendVertex->m_normal->m_z;
			}
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<651>");
		Float t_x=FLOAT(.0);
		Float t_y=FLOAT(.0);
		Float t_z=FLOAT(.0);
		DBG_LOCAL(t_x,"x")
		DBG_LOCAL(t_y,"y")
		DBG_LOCAL(t_z,"z")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<652>");
		t_x=FLOAT(0.0);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<653>");
		t_y=FLOAT(0.0);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<654>");
		t_z=FLOAT(0.0);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<657>");
		Float t_nx=FLOAT(.0);
		Float t_ny=FLOAT(.0);
		Float t_nz=FLOAT(.0);
		DBG_LOCAL(t_nx,"nx")
		DBG_LOCAL(t_ny,"ny")
		DBG_LOCAL(t_nz,"nz")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<658>");
		t_nx=FLOAT(0.0);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<659>");
		t_ny=FLOAT(0.0);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<660>");
		t_nz=FLOAT(0.0);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<663>");
		int t_influenceCount=t_vertex->m_vectorInfluence.Length();
		DBG_LOCAL(t_influenceCount,"influenceCount")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<664>");
		if(t_influenceCount==0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<665>");
			t_x=t_position->m_x;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<666>");
			t_y=t_position->m_y;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<667>");
			t_z=t_position->m_z;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<668>");
			t_nx=t_normal->m_x;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<669>");
			t_ny=t_normal->m_y;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<670>");
			t_nz=t_normal->m_z;
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<672>");
			for(int t_influenceId=0;t_influenceId<=t_influenceCount-1;t_influenceId=t_influenceId+1){
				DBG_BLOCK();
				DBG_LOCAL(t_influenceId,"influenceId")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<674>");
				c_CalInfluence* t_influence=t_vertex->m_vectorInfluence.At(t_influenceId);
				DBG_LOCAL(t_influence,"influence")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<677>");
				c_CalBone* t_bone=t_vectorBone.At(t_influence->m_boneId);
				DBG_LOCAL(t_bone,"bone")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<680>");
				c_CalVector* t_v=(new c_CalVector)->m_new2(t_position);
				DBG_LOCAL(t_v,"v")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<681>");
				t_v->p_multMatrixLocal(t_bone->p_getTransformMatrix());
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<682>");
				t_v->p_addLocal(t_bone->p_getTranslationBoneSpace());
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<684>");
				t_x+=t_influence->m_weight*t_v->m_x;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<685>");
				t_y+=t_influence->m_weight*t_v->m_y;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<686>");
				t_z+=t_influence->m_weight*t_v->m_z;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<689>");
				c_CalVector* t_n=(new c_CalVector)->m_new2(t_normal);
				DBG_LOCAL(t_n,"n")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<690>");
				t_n->p_multMatrixLocal(t_bone->p_getTransformMatrix());
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<692>");
				t_nx+=t_influence->m_weight*t_n->m_x;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<693>");
				t_ny+=t_influence->m_weight*t_n->m_y;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<694>");
				t_nz+=t_influence->m_weight*t_n->m_z;
			}
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<699>");
		if(t_submesh->p_getCoreSubmesh2()->p_getSpringCount()>0 && t_submesh->p_hasInternalData()==true){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<701>");
			c_CalPhysicalProperty* t_physicalProperty=t_vectorPhysicalProperty.At(t_vertexId);
			DBG_LOCAL(t_physicalProperty,"physicalProperty")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<704>");
			if(t_physicalProperty->m_weight==FLOAT(0.0)){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<705>");
				t_vertexBuffer.At(t_vi)=t_x*m_m_axisFactorX;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<706>");
				t_vertexBuffer.At(t_vi+1)=t_y*m_m_axisFactorY;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<707>");
				t_vertexBuffer.At(t_vi+2)=t_z*m_m_axisFactorZ;
			}
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<710>");
			t_vertexBuffer.At(t_vi)=t_x*m_m_axisFactorX;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<711>");
			t_vertexBuffer.At(t_vi+1)=t_y*m_m_axisFactorY;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<712>");
			t_vertexBuffer.At(t_vi+2)=t_z*m_m_axisFactorZ;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<716>");
		if(m_m_normalize==true){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<717>");
			t_nx/=m_m_axisFactorX;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<718>");
			t_ny/=m_m_axisFactorY;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<719>");
			t_nz/=m_m_axisFactorZ;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<721>");
			Float t_scale=FLOAT(1.0)/(Float)sqrt(t_nx*t_nx+t_ny*t_ny+t_nz*t_nz);
			DBG_LOCAL(t_scale,"scale")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<723>");
			t_vertexBuffer.At(t_vi+3)=t_nx*t_scale;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<724>");
			t_vertexBuffer.At(t_vi+4)=t_ny*t_scale;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<725>");
			t_vertexBuffer.At(t_vi+5)=t_nz*t_scale;
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<727>");
			t_vertexBuffer.At(t_vi+3)=t_nx;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<728>");
			t_vertexBuffer.At(t_vi+4)=t_ny;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<729>");
			t_vertexBuffer.At(t_vi+5)=t_nz;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<732>");
		t_vi=t_vi+6;
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<734>");
		if(t_textureCoordinateCount==0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<735>");
			t_vi=t_vi+t_numTexCoords*2;
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<737>");
			for(int t_mapId=0;t_mapId<=t_numTexCoords-1;t_mapId=t_mapId+1){
				DBG_BLOCK();
				DBG_LOCAL(t_mapId,"mapId")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<738>");
				c_CalTextureCoordinate* t_textureCoord=t_vectorvectorTextureCoordinate.At(t_mapId).At(t_vertexId);
				DBG_LOCAL(t_textureCoord,"textureCoord")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<739>");
				t_vertexBuffer.At(t_vi)=t_textureCoord->m_u;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<740>");
				t_vertexBuffer.At(t_vi+1)=t_textureCoord->m_v;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<742>");
				t_vi=t_vi+2;
			}
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/physique.monkey<747>");
	return t_vertexCount;
}
void c_CalPhysique::mark(){
	Object::mark();
	gc_mark_q(m_m_model);
}
String c_CalPhysique::debug(){
	String t="(CalPhysique)\n";
	t+=dbg_decl("m_model",&m_m_model);
	t+=dbg_decl("m_normalize",&m_m_normalize);
	t+=dbg_decl("m_axisFactorX",&m_m_axisFactorX);
	t+=dbg_decl("m_axisFactorY",&m_m_axisFactorY);
	t+=dbg_decl("m_axisFactorZ",&m_m_axisFactorZ);
	return t;
}
c_CalSpringSystem::c_CalSpringSystem(){
	m_m_model=0;
	m_m_gravity=0;
	m_m_force=0;
	m_m_collision=false;
}
c_CalSpringSystem* c_CalSpringSystem::m_new(){
	DBG_ENTER("CalSpringSystem.new")
	c_CalSpringSystem *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<11>");
	m_m_model=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<12>");
	gc_assign(m_m_gravity,(new c_CalVector)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<13>");
	gc_assign(m_m_force,(new c_CalVector)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<14>");
	m_m_collision=false;
	return this;
}
c_CalSpringSystem* c_CalSpringSystem::m_new2(c_CalModel* t_model){
	DBG_ENTER("CalSpringSystem.new")
	c_CalSpringSystem *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_model,"model")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<18>");
	gc_assign(m_m_model,t_model);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<19>");
	gc_assign(m_m_gravity,(new c_CalVector)->m_new3(FLOAT(0.0),FLOAT(0.0),FLOAT(-98.1)));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<20>");
	gc_assign(m_m_force,(new c_CalVector)->m_new3(FLOAT(0.0),FLOAT(0.5),FLOAT(0.0)));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<21>");
	m_m_collision=false;
	return this;
}
void c_CalSpringSystem::p_calculateForces(c_CalSubmesh* t_submesh,Float t_deltaTime){
	DBG_ENTER("CalSpringSystem.calculateForces")
	c_CalSpringSystem *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_submesh,"submesh")
	DBG_LOCAL(t_deltaTime,"deltaTime")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<28>");
	Array<c_CalVector* > t_vectorVertex=t_submesh->p_getVectorVertex();
	DBG_LOCAL(t_vectorVertex,"vectorVertex")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<31>");
	Array<c_CalPhysicalProperty* > t_vectorPhysicalProperty=t_submesh->p_getVectorPhysicalProperty();
	DBG_LOCAL(t_vectorPhysicalProperty,"vectorPhysicalProperty")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<34>");
	Array<c_CalPhysicalProperty* > t_vectorCorePhysicalProperty=t_submesh->p_getCoreSubmesh2()->p_getVectorPhysicalProperty();
	DBG_LOCAL(t_vectorCorePhysicalProperty,"vectorCorePhysicalProperty")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<37>");
	for(int t_vertexId=0;t_vertexId<=t_vectorVertex.Length()-1;t_vertexId=t_vertexId+1){
		DBG_BLOCK();
		DBG_LOCAL(t_vertexId,"vertexId")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<39>");
		c_CalPhysicalProperty* t_physicalProperty=t_vectorPhysicalProperty.At(t_vertexId);
		DBG_LOCAL(t_physicalProperty,"physicalProperty")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<42>");
		c_CalPhysicalProperty* t_corePhysicalProperty=t_vectorCorePhysicalProperty.At(t_vertexId);
		DBG_LOCAL(t_corePhysicalProperty,"corePhysicalProperty")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<45>");
		if(t_corePhysicalProperty->m_weight>FLOAT(0.0)){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<47>");
			t_physicalProperty->m_force->p_assign4(m_m_gravity);
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<48>");
			t_physicalProperty->m_force->p_multScalarLocal(t_corePhysicalProperty->m_weight);
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<49>");
			t_physicalProperty->m_force->p_addLocal(m_m_force);
		}
	}
}
void c_CalSpringSystem::p_calculateVertices2(c_CalSubmesh* t_submesh,Float t_deltaTime){
	DBG_ENTER("CalSpringSystem.calculateVertices")
	c_CalSpringSystem *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_submesh,"submesh")
	DBG_LOCAL(t_deltaTime,"deltaTime")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<58>");
	Array<c_CalVector* > t_vectorVertex=t_submesh->p_getVectorVertex();
	DBG_LOCAL(t_vectorVertex,"vectorVertex")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<61>");
	Array<c_CalPhysicalProperty* > t_vectorPhysicalProperty=t_submesh->p_getVectorPhysicalProperty();
	DBG_LOCAL(t_vectorPhysicalProperty,"vectorPhysicalProperty")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<64>");
	Array<c_CalPhysicalProperty* > t_vectorCorePhysicalProperty=t_submesh->p_getCoreSubmesh2()->p_getVectorPhysicalProperty();
	DBG_LOCAL(t_vectorCorePhysicalProperty,"vectorCorePhysicalProperty")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<67>");
	for(int t_vertexId=0;t_vertexId<=t_vectorVertex.Length()-1;t_vertexId=t_vertexId+1){
		DBG_BLOCK();
		DBG_LOCAL(t_vertexId,"vertexId")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<69>");
		c_CalVector* t_vertex=t_vectorVertex.At(t_vertexId);
		DBG_LOCAL(t_vertex,"vertex")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<72>");
		c_CalPhysicalProperty* t_physicalProperty=t_vectorPhysicalProperty.At(t_vertexId);
		DBG_LOCAL(t_physicalProperty,"physicalProperty")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<75>");
		c_CalPhysicalProperty* t_corePhysicalProperty=t_vectorCorePhysicalProperty.At(t_vertexId);
		DBG_LOCAL(t_corePhysicalProperty,"corePhysicalProperty")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<78>");
		c_CalVector* t_position=(new c_CalVector)->m_new2(t_physicalProperty->m_position);
		DBG_LOCAL(t_position,"position")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<81>");
		if(t_corePhysicalProperty->m_weight>FLOAT(0.0)){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<83>");
			t_physicalProperty->m_position->p_addLocal(bb_math_vectorSub(t_position,t_physicalProperty->m_positionOld)->p_multScalarLocal(FLOAT(0.99))->p_addLocal(bb_math_vectorScalarMult(t_physicalProperty->m_force,t_deltaTime*t_deltaTime/t_corePhysicalProperty->m_weight)));
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<85>");
			c_CalSkeleton* t_skeleton=m_m_model->p_getSkeleton();
			DBG_LOCAL(t_skeleton,"skeleton")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<88>");
			if(m_m_collision==true){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<89>");
				Array<c_CalBone* > t_vectorBone=t_skeleton->p_getVectorBone();
				DBG_LOCAL(t_vectorBone,"vectorBone")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<91>");
				for(int t_boneId=0;t_boneId<=t_vectorBone.Length()-1;t_boneId=t_boneId+1){
					DBG_BLOCK();
					DBG_LOCAL(t_boneId,"boneId")
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<92>");
					c_CalBoundingBox* t_p=t_vectorBone.At(t_boneId)->p_getBoundingBox();
					DBG_LOCAL(t_p,"p")
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<93>");
					bool t_isIn=true;
					DBG_LOCAL(t_isIn,"isIn")
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<94>");
					int t_min=7696;
					DBG_LOCAL(t_min,"min")
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<95>");
					int t_index=-1;
					DBG_LOCAL(t_index,"index")
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<97>");
					for(int t_faceId=0;t_faceId<=5;t_faceId=t_faceId+1){
						DBG_BLOCK();
						DBG_LOCAL(t_faceId,"faceId")
						DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<98>");
						if(t_p->m_plane.At(t_faceId)->p_eval(t_physicalProperty->m_position)<=FLOAT(0.0)){
							DBG_BLOCK();
							DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<99>");
							t_isIn=false;
						}else{
							DBG_BLOCK();
							DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<101>");
							Float t_dist=t_p->m_plane.At(t_faceId)->p_dist(t_physicalProperty->m_position);
							DBG_LOCAL(t_dist,"dist")
							DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<102>");
							if(t_dist<Float(t_min)){
								DBG_BLOCK();
								DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<103>");
								t_index=t_faceId;
								DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<104>");
								t_min=int(t_dist);
							}
						}
					}
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<109>");
					if(t_isIn==true && t_index!=-1){
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<110>");
						c_CalVector* t_normal=(new c_CalVector)->m_new3(t_p->m_plane.At(t_index)->m_a,t_p->m_plane.At(t_index)->m_b,t_p->m_plane.At(t_index)->m_c);
						DBG_LOCAL(t_normal,"normal")
						DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<111>");
						t_normal->p_normalize();
						DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<112>");
						t_physicalProperty->m_position->p_subLocal(bb_math_vectorScalarMult(t_normal,Float(t_min)));
					}
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<115>");
					t_isIn=true;
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<117>");
					for(int t_faceId2=0;t_faceId2<=5;t_faceId2=t_faceId2+1){
						DBG_BLOCK();
						DBG_LOCAL(t_faceId2,"faceId")
						DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<118>");
						if(t_p->m_plane.At(t_faceId2)->p_eval(t_physicalProperty->m_position)<FLOAT(0.0)){
							DBG_BLOCK();
							DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<119>");
							t_isIn=false;
						}
					}
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<122>");
					if(t_isIn==true){
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<123>");
						t_physicalProperty->m_position->p_assign4(t_vectorVertex.At(t_vertexId));
					}
				}
			}
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<128>");
			t_physicalProperty->m_position->p_assign4(t_vectorVertex.At(t_vertexId));
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<132>");
		t_physicalProperty->m_positionOld->p_assign4(t_position);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<135>");
		t_vertex->p_assign4(t_physicalProperty->m_position);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<138>");
		t_physicalProperty->m_force->p_clear();
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<142>");
	Array<c_CalSpring* > t_vectorSpring=t_submesh->p_getCoreSubmesh2()->p_getVectorSpring();
	DBG_LOCAL(t_vectorSpring,"vectorSpring")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<145>");
	int t_TOTAL_ITERATION_COUNT=2;
	DBG_LOCAL(t_TOTAL_ITERATION_COUNT,"TOTAL_ITERATION_COUNT")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<146>");
	for(int t_iterationCount=0;t_iterationCount<=t_TOTAL_ITERATION_COUNT-1;t_iterationCount=t_iterationCount+1){
		DBG_BLOCK();
		DBG_LOCAL(t_iterationCount,"iterationCount")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<148>");
		for(int t_springId=0;t_springId<=t_vectorSpring.Length()-1;t_springId=t_springId+1){
			DBG_BLOCK();
			DBG_LOCAL(t_springId,"springId")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<150>");
			c_CalSpring* t_spring=t_vectorSpring.At(t_springId);
			DBG_LOCAL(t_spring,"spring")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<153>");
			c_CalVector* t_distance=bb_math_vectorSub(t_vectorVertex.At(t_spring->m_vertexId.At(1)),t_vectorVertex.At(t_spring->m_vertexId.At(0)));
			DBG_LOCAL(t_distance,"distance")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<156>");
			Float t_Length=t_distance->p_length();
			DBG_LOCAL(t_Length,"Length")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<158>");
			if(t_Length>FLOAT(0.0)){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<159>");
				Array<Float > t_factor=Array<Float >(2);
				DBG_LOCAL(t_factor,"factor")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<160>");
				t_factor.At(0)=(t_Length-t_spring->m_idleLength)/t_Length;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<161>");
				t_factor.At(1)=t_factor.At(0);
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<163>");
				if(t_vectorCorePhysicalProperty.At(t_spring->m_vertexId.At(0))->m_weight>FLOAT(0.0)){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<164>");
					t_factor.At(0)=t_factor.At(0)/FLOAT(2.0);
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<165>");
					t_factor.At(1)=t_factor.At(1)/FLOAT(2.0);
				}else{
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<167>");
					t_factor.At(0)=FLOAT(0.0);
				}
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<170>");
				if(t_vectorCorePhysicalProperty.At(t_spring->m_vertexId.At(1))->m_weight<=FLOAT(0.0)){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<171>");
					t_factor.At(0)=t_factor.At(0)*FLOAT(2.0);
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<172>");
					t_factor.At(1)=FLOAT(0.0);
				}
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<175>");
				t_vectorVertex.At(t_spring->m_vertexId.At(0))->p_addLocal(bb_math_vectorScalarMult(t_distance,t_factor.At(0)));
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<176>");
				t_vectorPhysicalProperty.At(t_spring->m_vertexId.At(0))->m_position->p_assign4(t_vectorVertex.At(t_spring->m_vertexId.At(0)));
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<178>");
				t_vectorVertex.At(t_spring->m_vertexId.At(1))->p_subLocal(bb_math_vectorScalarMult(t_distance,t_factor.At(1)));
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<179>");
				t_vectorPhysicalProperty.At(t_spring->m_vertexId.At(1))->m_position->p_assign4(t_vectorVertex.At(t_spring->m_vertexId.At(1)));
			}
		}
	}
}
void c_CalSpringSystem::p_update(Float t_deltaTime){
	DBG_ENTER("CalSpringSystem.update")
	c_CalSpringSystem *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_deltaTime,"deltaTime")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<189>");
	Array<c_CalMesh* > t_vectorMesh=m_m_model->p_getVectorMesh();
	DBG_LOCAL(t_vectorMesh,"vectorMesh")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<192>");
	for(int t_meshId=0;t_meshId<=t_vectorMesh.Length()-1;t_meshId=t_meshId+1){
		DBG_BLOCK();
		DBG_LOCAL(t_meshId,"meshId")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<194>");
		Array<c_CalSubmesh* > t_vectorSubmesh=t_vectorMesh.At(t_meshId)->p_getVectorSubmesh();
		DBG_LOCAL(t_vectorSubmesh,"vectorSubmesh")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<197>");
		for(int t_submeshId=0;t_submeshId<=t_vectorSubmesh.Length()-1;t_submeshId=t_submeshId+1){
			DBG_BLOCK();
			DBG_LOCAL(t_submeshId,"submeshId")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<198>");
			c_CalSubmesh* t_submesh=t_vectorSubmesh.At(t_submeshId);
			DBG_LOCAL(t_submesh,"submesh")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<201>");
			if(t_submesh->p_getCoreSubmesh2()->p_getSpringCount()>0 && t_submesh->p_hasInternalData()){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<203>");
				p_calculateForces(t_submesh,t_deltaTime);
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/springsystem.monkey<206>");
				p_calculateVertices2(t_submesh,t_deltaTime);
			}
		}
	}
}
void c_CalSpringSystem::mark(){
	Object::mark();
	gc_mark_q(m_m_model);
	gc_mark_q(m_m_gravity);
	gc_mark_q(m_m_force);
}
String c_CalSpringSystem::debug(){
	String t="(CalSpringSystem)\n";
	t+=dbg_decl("m_model",&m_m_model);
	t+=dbg_decl("m_gravity",&m_m_gravity);
	t+=dbg_decl("m_force",&m_m_force);
	t+=dbg_decl("m_collision",&m_m_collision);
	return t;
}
c_CalRenderer::c_CalRenderer(){
	m_m_model=0;
	m_m_selectedSubmesh=0;
}
c_CalRenderer* c_CalRenderer::m_new(){
	DBG_ENTER("CalRenderer.new")
	c_CalRenderer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<9>");
	m_m_model=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<10>");
	m_m_selectedSubmesh=0;
	return this;
}
c_CalRenderer* c_CalRenderer::m_new2(c_CalModel* t_model){
	DBG_ENTER("CalRenderer.new")
	c_CalRenderer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_model,"model")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<14>");
	gc_assign(m_m_model,t_model);
	return this;
}
c_CalRenderer* c_CalRenderer::m_new3(c_CalRenderer* t_renderer){
	DBG_ENTER("CalRenderer.new")
	c_CalRenderer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_renderer,"renderer")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<18>");
	gc_assign(m_m_model,t_renderer->m_m_model);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<19>");
	gc_assign(m_m_selectedSubmesh,t_renderer->m_m_selectedSubmesh);
	return this;
}
bool c_CalRenderer::p_beginRendering(){
	DBG_ENTER("CalRenderer.beginRendering")
	c_CalRenderer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<24>");
	Array<c_CalMesh* > t_vectorMesh=m_m_model->p_getVectorMesh();
	DBG_LOCAL(t_vectorMesh,"vectorMesh")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<27>");
	if(t_vectorMesh.Length()==0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<28>");
		return false;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<32>");
	gc_assign(m_m_selectedSubmesh,t_vectorMesh.At(0)->p_getSubmesh(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<33>");
	if(m_m_selectedSubmesh==0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<34>");
		return false;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<36>");
	return true;
}
int c_CalRenderer::p_getMeshCount(){
	DBG_ENTER("CalRenderer.getMeshCount")
	c_CalRenderer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<131>");
	Array<c_CalMesh* > t_vectorMesh=m_m_model->p_getVectorMesh();
	DBG_LOCAL(t_vectorMesh,"vectorMesh")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<132>");
	int t_=t_vectorMesh.Length();
	return t_;
}
int c_CalRenderer::p_getSubmeshCount(int t_meshId){
	DBG_ENTER("CalRenderer.getSubmeshCount")
	c_CalRenderer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_meshId,"meshId")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<202>");
	Array<c_CalMesh* > t_vectorMesh=m_m_model->p_getVectorMesh();
	DBG_LOCAL(t_vectorMesh,"vectorMesh")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<205>");
	if(t_meshId<0 || t_meshId>=t_vectorMesh.Length()){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<206>");
		bbPrint(String(L"Invalid Mesh ID",15));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<207>");
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<210>");
	int t_=t_vectorMesh.At(t_meshId)->p_getSubmeshCount2();
	return t_;
}
bool c_CalRenderer::p_selectMeshSubmesh(int t_meshId,int t_submeshId){
	DBG_ENTER("CalRenderer.selectMeshSubmesh")
	c_CalRenderer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_meshId,"meshId")
	DBG_LOCAL(t_submeshId,"submeshId")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<450>");
	Array<c_CalMesh* > t_vectorMesh=m_m_model->p_getVectorMesh();
	DBG_LOCAL(t_vectorMesh,"vectorMesh")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<453>");
	if(t_meshId<0 || t_meshId>=t_vectorMesh.Length()){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<454>");
		bbPrint(String(L"Invalid Mesh ID",15));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<455>");
		return false;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<459>");
	gc_assign(m_m_selectedSubmesh,t_vectorMesh.At(t_meshId)->p_getSubmesh(t_submeshId));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<460>");
	if(m_m_selectedSubmesh==0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<461>");
		return false;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<464>");
	return true;
}
int c_CalRenderer::p_getVertexCount(){
	DBG_ENTER("CalRenderer.getVertexCount")
	c_CalRenderer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<244>");
	int t_=m_m_selectedSubmesh->p_getVertexCount();
	return t_;
}
int c_CalRenderer::p_getFaceCount(){
	DBG_ENTER("CalRenderer.getFaceCount")
	c_CalRenderer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<95>");
	int t_=m_m_selectedSubmesh->p_getFaceCount();
	return t_;
}
int c_CalRenderer::p_getVertices(Array<Float > t_vertexBuffer,int t_stride){
	DBG_ENTER("CalRenderer.getVertices")
	c_CalRenderer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_vertexBuffer,"vertexBuffer")
	DBG_LOCAL(t_stride,"stride")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<250>");
	if(m_m_selectedSubmesh->p_hasInternalData()==true){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<252>");
		Array<c_CalVector* > t_vectorVertex=m_m_selectedSubmesh->p_getVectorVertex();
		DBG_LOCAL(t_vectorVertex,"vectorVertex")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<255>");
		int t_vertexCount=m_m_selectedSubmesh->p_getVertexCount();
		DBG_LOCAL(t_vertexCount,"vertexCount")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<259>");
		if(t_stride<=0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<260>");
			t_stride=3;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<262>");
		int t_j=0;
		DBG_LOCAL(t_j,"j")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<263>");
		for(int t_i=0;t_i<=t_vertexCount-1;t_i=t_i+1){
			DBG_BLOCK();
			DBG_LOCAL(t_i,"i")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<264>");
			c_CalVector* t_vertex=t_vectorVertex.At(t_i);
			DBG_LOCAL(t_vertex,"vertex")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<265>");
			t_vertexBuffer.At(t_j)=t_vertex->m_x;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<266>");
			t_vertexBuffer.At(t_j+1)=t_vertex->m_y;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<267>");
			t_vertexBuffer.At(t_j+2)=t_vertex->m_z;
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<268>");
			t_j+=t_stride;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<271>");
		return t_vertexCount;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<275>");
	int t_=m_m_model->p_getPhysique()->p_calculateVertices(m_m_selectedSubmesh,t_vertexBuffer,t_stride);
	return t_;
}
int c_CalRenderer::p_getFaces(Array<int > t_faceBuffer){
	DBG_ENTER("CalRenderer.getFaces")
	c_CalRenderer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_faceBuffer,"faceBuffer")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<99>");
	int t_=m_m_selectedSubmesh->p_getFaces(t_faceBuffer);
	return t_;
}
void c_CalRenderer::p_endRendering(){
	DBG_ENTER("CalRenderer.endRendering")
	c_CalRenderer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<40>");
	m_m_selectedSubmesh=0;
}
int c_CalRenderer::p_getVerticesNormalsAndTexCoords(Array<Float > t_vertexBuffer,int t_numTexCoords){
	DBG_ENTER("CalRenderer.getVerticesNormalsAndTexCoords")
	c_CalRenderer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_vertexBuffer,"vertexBuffer")
	DBG_LOCAL(t_numTexCoords,"numTexCoords")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<357>");
	if(m_m_selectedSubmesh->p_hasInternalData()==true){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<359>");
		Array<c_CalVector* > t_vectorVertex=m_m_selectedSubmesh->p_getVectorVertex();
		DBG_LOCAL(t_vectorVertex,"vectorVertex")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<361>");
		Array<c_CalVector* > t_vectorNormal=m_m_selectedSubmesh->p_getVectorNormal();
		DBG_LOCAL(t_vectorNormal,"vectorNormal")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<363>");
		Array<Array<c_CalTextureCoordinate* > > t_vectorvectorTextureCoordinate=m_m_selectedSubmesh->p_getCoreSubmesh2()->p_getVectorVectorTextureCoordinate();
		DBG_LOCAL(t_vectorvectorTextureCoordinate,"vectorvectorTextureCoordinate")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<365>");
		int t_textureCoordinateCount=t_vectorvectorTextureCoordinate.Length();
		DBG_LOCAL(t_textureCoordinateCount,"textureCoordinateCount")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<367>");
		if(t_numTexCoords<0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<368>");
			t_numTexCoords=1;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<371>");
		if(t_numTexCoords<0 || t_numTexCoords>t_textureCoordinateCount){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<372>");
			if(t_textureCoordinateCount!=0){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<373>");
				bbPrint(String(L"Invalid Texture Coord Count",27));
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<374>");
				return -1;
			}
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<379>");
		int t_vertexCount=m_m_selectedSubmesh->p_getVertexCount();
		DBG_LOCAL(t_vertexCount,"vertexCount")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<382>");
		if(t_textureCoordinateCount==0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<383>");
			int t_vi=0;
			DBG_LOCAL(t_vi,"vi")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<384>");
			for(int t_vertexId=0;t_vertexId<=t_vertexCount-1;t_vertexId=t_vertexId+1){
				DBG_BLOCK();
				DBG_LOCAL(t_vertexId,"vertexId")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<385>");
				c_CalVector* t_vertex=t_vectorVertex.At(t_vertexId);
				DBG_LOCAL(t_vertex,"vertex")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<386>");
				c_CalVector* t_normal=t_vectorNormal.At(t_vertexId);
				DBG_LOCAL(t_normal,"normal")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<387>");
				t_vertexBuffer.At(t_vi)=t_vertex->m_x;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<388>");
				t_vertexBuffer.At(t_vi+1)=t_vertex->m_y;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<389>");
				t_vertexBuffer.At(t_vi+2)=t_vertex->m_z;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<390>");
				t_vertexBuffer.At(t_vi+3)=t_normal->m_x;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<391>");
				t_vertexBuffer.At(t_vi+4)=t_normal->m_y;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<392>");
				t_vertexBuffer.At(t_vi+5)=t_normal->m_z;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<393>");
				t_vi+=6+t_numTexCoords*2;
			}
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<396>");
			if(t_numTexCoords==1){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<397>");
				int t_vi2=0;
				DBG_LOCAL(t_vi2,"vi")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<398>");
				for(int t_vertexId2=0;t_vertexId2<=t_vertexCount-1;t_vertexId2=t_vertexId2+1){
					DBG_BLOCK();
					DBG_LOCAL(t_vertexId2,"vertexId")
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<399>");
					c_CalVector* t_vertex2=t_vectorVertex.At(t_vertexId2);
					DBG_LOCAL(t_vertex2,"vertex")
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<400>");
					c_CalVector* t_normal2=t_vectorNormal.At(t_vertexId2);
					DBG_LOCAL(t_normal2,"normal")
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<401>");
					c_CalTextureCoordinate* t_texCoord=t_vectorvectorTextureCoordinate.At(0).At(t_vertexId2);
					DBG_LOCAL(t_texCoord,"texCoord")
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<402>");
					t_vertexBuffer.At(t_vi2)=t_vertex2->m_x;
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<403>");
					t_vertexBuffer.At(t_vi2+1)=t_vertex2->m_y;
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<404>");
					t_vertexBuffer.At(t_vi2+2)=t_vertex2->m_z;
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<405>");
					t_vertexBuffer.At(t_vi2+3)=t_normal2->m_x;
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<406>");
					t_vertexBuffer.At(t_vi2+4)=t_normal2->m_y;
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<407>");
					t_vertexBuffer.At(t_vi2+5)=t_normal2->m_z;
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<408>");
					t_vertexBuffer.At(t_vi2+6)=t_texCoord->m_u;
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<409>");
					t_vertexBuffer.At(t_vi2+7)=t_texCoord->m_v;
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<410>");
					t_vi2+=8;
				}
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<413>");
				int t_vi3=0;
				DBG_LOCAL(t_vi3,"vi")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<414>");
				for(int t_vertexId3=0;t_vertexId3<=t_vertexCount-1;t_vertexId3=t_vertexId3+1){
					DBG_BLOCK();
					DBG_LOCAL(t_vertexId3,"vertexId")
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<415>");
					c_CalVector* t_vertex3=t_vectorVertex.At(t_vertexId3);
					DBG_LOCAL(t_vertex3,"vertex")
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<416>");
					c_CalVector* t_normal3=t_vectorNormal.At(t_vertexId3);
					DBG_LOCAL(t_normal3,"normal")
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<417>");
					t_vertexBuffer.At(t_vi3)=t_vertex3->m_x;
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<418>");
					t_vertexBuffer.At(t_vi3+1)=t_vertex3->m_y;
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<419>");
					t_vertexBuffer.At(t_vi3+2)=t_vertex3->m_z;
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<420>");
					t_vertexBuffer.At(t_vi3+3)=t_normal3->m_x;
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<421>");
					t_vertexBuffer.At(t_vi3+4)=t_normal3->m_y;
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<422>");
					t_vertexBuffer.At(t_vi3+5)=t_normal3->m_z;
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<423>");
					t_vi3+=6;
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<425>");
					for(int t_mapId=0;t_mapId<=t_numTexCoords-1;t_mapId=t_mapId+1){
						DBG_BLOCK();
						DBG_LOCAL(t_mapId,"mapId")
						DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<426>");
						c_CalTextureCoordinate* t_texCoord2=t_vectorvectorTextureCoordinate.At(t_mapId).At(t_vertexId3);
						DBG_LOCAL(t_texCoord2,"texCoord")
						DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<427>");
						t_vertexBuffer.At(t_vi3)=t_texCoord2->m_u;
						DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<428>");
						t_vertexBuffer.At(t_vi3+1)=t_texCoord2->m_v;
						DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<429>");
						t_vi3+=2;
					}
				}
			}
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<435>");
		return t_vertexCount;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/renderer.monkey<439>");
	int t_=m_m_model->p_getPhysique()->p_calculateVerticesNormalsAndTexCoords(m_m_selectedSubmesh,t_vertexBuffer,t_numTexCoords);
	return t_;
}
void c_CalRenderer::mark(){
	Object::mark();
	gc_mark_q(m_m_model);
	gc_mark_q(m_m_selectedSubmesh);
}
String c_CalRenderer::debug(){
	String t="(CalRenderer)\n";
	t+=dbg_decl("m_model",&m_m_model);
	t+=dbg_decl("m_selectedSubmesh",&m_m_selectedSubmesh);
	return t;
}
c_CalSubmesh::c_CalSubmesh(){
	m_m_coreSubmesh=0;
	m_m_vectorMorphTargetWeight=Array<Float >();
	m_m_vectorVertex=Array<c_CalVector* >();
	m_m_vectorNormal=Array<c_CalVector* >();
	m_m_vectorvectorTangentSpace=Array<Array<c_CalTangentSpace* > >();
	m_m_vectorFace=Array<c_CalFace* >();
	m_m_vectorPhysicalProperty=Array<c_CalPhysicalProperty* >();
	m_m_vertexCount=0;
	m_m_faceCount=0;
	m_m_coreMaterialId=0;
	m_m_bInternalData=false;
}
c_CalSubmesh* c_CalSubmesh::m_new(){
	DBG_ENTER("CalSubmesh.new")
	c_CalSubmesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<18>");
	m_m_coreSubmesh=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<19>");
	gc_assign(m_m_vectorMorphTargetWeight,Array<Float >(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<20>");
	gc_assign(m_m_vectorVertex,Array<c_CalVector* >(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<21>");
	gc_assign(m_m_vectorNormal,Array<c_CalVector* >(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<22>");
	gc_assign(m_m_vectorvectorTangentSpace,Array<Array<c_CalTangentSpace* > >(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<23>");
	gc_assign(m_m_vectorFace,Array<c_CalFace* >(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<24>");
	gc_assign(m_m_vectorPhysicalProperty,Array<c_CalPhysicalProperty* >(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<25>");
	m_m_vertexCount=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<26>");
	m_m_faceCount=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<27>");
	m_m_coreMaterialId=-1;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<28>");
	m_m_bInternalData=false;
	return this;
}
void c_CalSubmesh::p_setLodLevel(Float t_lodLevel){
	DBG_ENTER("CalSubmesh.setLodLevel")
	c_CalSubmesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_lodLevel,"lodLevel")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<154>");
	if(t_lodLevel<FLOAT(0.0)){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<155>");
		t_lodLevel=FLOAT(0.0);
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<156>");
		if(t_lodLevel>FLOAT(1.0)){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<157>");
			t_lodLevel=FLOAT(1.0);
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<160>");
	int t_lodCount=m_m_coreSubmesh->p_getLodCount();
	DBG_LOCAL(t_lodCount,"lodCount")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<163>");
	t_lodCount=int((Float)floor((FLOAT(1.0)-t_lodLevel)*Float(t_lodCount)));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<166>");
	m_m_vertexCount=m_m_coreSubmesh->p_getVertexCount()-t_lodCount;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<169>");
	Array<c_CalFace* > t_vectorFace=m_m_coreSubmesh->p_getVectorFace();
	DBG_LOCAL(t_vectorFace,"vectorFace")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<172>");
	Array<c_CalVertex* > t_vectorVertex=m_m_coreSubmesh->p_getVectorVertex();
	DBG_LOCAL(t_vectorVertex,"vectorVertex")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<175>");
	m_m_faceCount=t_vectorFace.Length();
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<177>");
	for(int t_vertexId=t_vectorVertex.Length()-1;t_vertexId>=m_m_vertexCount;t_vertexId=t_vertexId+-1){
		DBG_BLOCK();
		DBG_LOCAL(t_vertexId,"vertexId")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<178>");
		m_m_faceCount-=t_vectorVertex.At(t_vertexId)->m_faceCollapseCount;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<182>");
	for(int t_faceId=0;t_faceId<=m_m_faceCount-1;t_faceId=t_faceId+1){
		DBG_BLOCK();
		DBG_LOCAL(t_faceId,"faceId")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<183>");
		for(int t_vertexId2=0;t_vertexId2<=2;t_vertexId2=t_vertexId2+1){
			DBG_BLOCK();
			DBG_LOCAL(t_vertexId2,"vertexId")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<185>");
			int t_collapsedVertexId=t_vectorFace.At(t_faceId)->m_vertexId.At(t_vertexId2);
			DBG_LOCAL(t_collapsedVertexId,"collapsedVertexId")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<189>");
			while(t_collapsedVertexId>=m_m_vertexCount){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<190>");
				t_collapsedVertexId=t_vectorVertex.At(t_collapsedVertexId)->m_collapseId;
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<194>");
			m_m_vectorFace.At(t_faceId)->m_vertexId.At(t_vertexId2)=t_collapsedVertexId;
		}
	}
}
c_CalSubmesh* c_CalSubmesh::m_new2(c_CalCoreSubmesh* t_coreSubmesh){
	DBG_ENTER("CalSubmesh.new")
	c_CalSubmesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_coreSubmesh,"coreSubmesh")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<33>");
	gc_assign(m_m_coreSubmesh,t_coreSubmesh);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<34>");
	gc_assign(m_m_vectorMorphTargetWeight,Array<Float >(t_coreSubmesh->p_getCoreSubMorphTargetCount()));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<35>");
	gc_assign(m_m_vectorVertex,Array<c_CalVector* >(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<36>");
	gc_assign(m_m_vectorNormal,Array<c_CalVector* >(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<37>");
	gc_assign(m_m_vectorvectorTangentSpace,Array<Array<c_CalTangentSpace* > >(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<38>");
	gc_assign(m_m_vectorFace,Array<c_CalFace* >(t_coreSubmesh->p_getFaceCount()));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<39>");
	gc_assign(m_m_vectorPhysicalProperty,Array<c_CalPhysicalProperty* >(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<40>");
	m_m_vertexCount=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<41>");
	m_m_faceCount=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<42>");
	m_m_coreMaterialId=-1;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<43>");
	m_m_bInternalData=false;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<45>");
	for(int t_faceId=0;t_faceId<=m_m_vectorFace.Length()-1;t_faceId=t_faceId+1){
		DBG_BLOCK();
		DBG_LOCAL(t_faceId,"faceId")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<46>");
		gc_assign(m_m_vectorFace.At(t_faceId),(new c_CalFace)->m_new());
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<49>");
	p_setLodLevel(FLOAT(1.0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<51>");
	int t_morphTargetCount=t_coreSubmesh->p_getCoreSubMorphTargetCount();
	DBG_LOCAL(t_morphTargetCount,"morphTargetCount")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<52>");
	for(int t_morphTargetId=0;t_morphTargetId<=t_morphTargetCount-1;t_morphTargetId=t_morphTargetId+1){
		DBG_BLOCK();
		DBG_LOCAL(t_morphTargetId,"morphTargetId")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<53>");
		m_m_vectorMorphTargetWeight.At(t_morphTargetId)=FLOAT(0.0);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<56>");
	if(t_coreSubmesh->p_getSpringCount()>0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<57>");
		int t_vertexCount=t_coreSubmesh->p_getVertexCount();
		DBG_LOCAL(t_vertexCount,"vertexCount")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<59>");
		gc_assign(m_m_vectorVertex,Array<c_CalVector* >(t_vertexCount));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<60>");
		gc_assign(m_m_vectorNormal,Array<c_CalVector* >(t_vertexCount));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<62>");
		gc_assign(m_m_vectorvectorTangentSpace,Array<Array<c_CalTangentSpace* > >(t_coreSubmesh->p_getVectorVectorTangentSpace().Length()));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<64>");
		gc_assign(m_m_vectorPhysicalProperty,Array<c_CalPhysicalProperty* >(t_vertexCount));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<67>");
		Array<c_CalVertex* > t_vectorVertex=t_coreSubmesh->p_getVectorVertex();
		DBG_LOCAL(t_vectorVertex,"vectorVertex")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<70>");
		for(int t_vertexId=0;t_vertexId<=t_vertexCount-1;t_vertexId=t_vertexId+1){
			DBG_BLOCK();
			DBG_LOCAL(t_vertexId,"vertexId")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<72>");
			gc_assign(m_m_vectorVertex.At(t_vertexId),(new c_CalVector)->m_new2(t_vectorVertex.At(t_vertexId)->m_position));
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<73>");
			c_CalPhysicalProperty* t_physicalProperty=(new c_CalPhysicalProperty)->m_new();
			DBG_LOCAL(t_physicalProperty,"physicalProperty")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<74>");
			t_physicalProperty->m_position->p_assign4(t_vectorVertex.At(t_vertexId)->m_position);
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<75>");
			t_physicalProperty->m_positionOld->p_assign4(t_vectorVertex.At(t_vertexId)->m_position);
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<76>");
			gc_assign(m_m_vectorPhysicalProperty.At(t_vertexId),t_physicalProperty);
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<79>");
			gc_assign(m_m_vectorNormal.At(t_vertexId),(new c_CalVector)->m_new2(t_vectorVertex.At(t_vertexId)->m_normal));
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<82>");
		m_m_bInternalData=true;
	}
	return this;
}
int c_CalSubmesh::p_getVertexCount(){
	DBG_ENTER("CalSubmesh.getVertexCount")
	c_CalSubmesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<131>");
	return m_m_vertexCount;
}
int c_CalSubmesh::p_getFaceCount(){
	DBG_ENTER("CalSubmesh.getFaceCount")
	c_CalSubmesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<98>");
	return m_m_faceCount;
}
bool c_CalSubmesh::p_hasInternalData(){
	DBG_ENTER("CalSubmesh.hasInternalData")
	c_CalSubmesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<135>");
	return m_m_bInternalData;
}
Array<c_CalVector* > c_CalSubmesh::p_getVectorVertex(){
	DBG_ENTER("CalSubmesh.getVectorVertex")
	c_CalSubmesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<127>");
	return m_m_vectorVertex;
}
c_CalCoreSubmesh* c_CalSubmesh::p_getCoreSubmesh2(){
	DBG_ENTER("CalSubmesh.getCoreSubmesh")
	c_CalSubmesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<90>");
	return m_m_coreSubmesh;
}
int c_CalSubmesh::p_getMorphTargetWeightCount(){
	DBG_ENTER("CalSubmesh.getMorphTargetWeightCount")
	c_CalSubmesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<258>");
	int t_=m_m_vectorMorphTargetWeight.Length();
	return t_;
}
Float c_CalSubmesh::p_getBaseWeight(){
	DBG_ENTER("CalSubmesh.getBaseWeight")
	c_CalSubmesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<248>");
	Float t_baseWeight=FLOAT(1.0);
	DBG_LOCAL(t_baseWeight,"baseWeight")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<249>");
	int t_morphTargetCount=p_getMorphTargetWeightCount();
	DBG_LOCAL(t_morphTargetCount,"morphTargetCount")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<250>");
	for(int t_morphTargetId=0;t_morphTargetId<=t_morphTargetCount-1;t_morphTargetId=t_morphTargetId+1){
		DBG_BLOCK();
		DBG_LOCAL(t_morphTargetId,"morphTargetId")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<251>");
		t_baseWeight-=m_m_vectorMorphTargetWeight.At(t_morphTargetId);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<254>");
	return t_baseWeight;
}
Float c_CalSubmesh::p_getMorphTargetWeight(int t_blendId){
	DBG_ENTER("CalSubmesh.getMorphTargetWeight")
	c_CalSubmesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_blendId,"blendId")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<244>");
	return m_m_vectorMorphTargetWeight.At(t_blendId);
}
int c_CalSubmesh::p_getFaces(Array<int > t_faceBuffer){
	DBG_ENTER("CalSubmesh.getFaces")
	c_CalSubmesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_faceBuffer,"faceBuffer")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<102>");
	int t_j=0;
	DBG_LOCAL(t_j,"j")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<103>");
	for(int t_i=0;t_i<=m_m_faceCount-1;t_i=t_i+1){
		DBG_BLOCK();
		DBG_LOCAL(t_i,"i")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<104>");
		Array<int > t_faceVertId=m_m_vectorFace.At(t_i)->m_vertexId;
		DBG_LOCAL(t_faceVertId,"faceVertId")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<105>");
		t_faceBuffer.At(t_j)=t_faceVertId.At(0);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<106>");
		t_faceBuffer.At(t_j+1)=t_faceVertId.At(1);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<107>");
		t_faceBuffer.At(t_j+2)=t_faceVertId.At(2);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<108>");
		t_j=t_j+3;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<111>");
	return m_m_faceCount;
}
void c_CalSubmesh::p_setMorphTargetWeight(int t_blendId,Float t_weight){
	DBG_ENTER("CalSubmesh.setMorphTargetWeight")
	c_CalSubmesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_blendId,"blendId")
	DBG_LOCAL(t_weight,"weight")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<240>");
	m_m_vectorMorphTargetWeight.At(t_blendId)=t_weight;
}
Array<c_CalVector* > c_CalSubmesh::p_getVectorNormal(){
	DBG_ENTER("CalSubmesh.getVectorNormal")
	c_CalSubmesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<115>");
	return m_m_vectorNormal;
}
Array<Array<c_CalTangentSpace* > > c_CalSubmesh::p_getVectorVectorTangentSpace(){
	DBG_ENTER("CalSubmesh.getVectorVectorTangentSpace")
	c_CalSubmesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<119>");
	return m_m_vectorvectorTangentSpace;
}
bool c_CalSubmesh::p_isTangentsEnabled(int t_mapId){
	DBG_ENTER("CalSubmesh.isTangentsEnabled")
	c_CalSubmesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_mapId,"mapId")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<200>");
	bool t_=m_m_coreSubmesh->p_isTangentsEnabled(t_mapId);
	return t_;
}
Array<c_CalPhysicalProperty* > c_CalSubmesh::p_getVectorPhysicalProperty(){
	DBG_ENTER("CalSubmesh.getVectorPhysicalProperty")
	c_CalSubmesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/submesh.monkey<123>");
	return m_m_vectorPhysicalProperty;
}
void c_CalSubmesh::mark(){
	Object::mark();
	gc_mark_q(m_m_coreSubmesh);
	gc_mark_q(m_m_vectorMorphTargetWeight);
	gc_mark_q(m_m_vectorVertex);
	gc_mark_q(m_m_vectorNormal);
	gc_mark_q(m_m_vectorvectorTangentSpace);
	gc_mark_q(m_m_vectorFace);
	gc_mark_q(m_m_vectorPhysicalProperty);
}
String c_CalSubmesh::debug(){
	String t="(CalSubmesh)\n";
	t+=dbg_decl("m_coreSubmesh",&m_m_coreSubmesh);
	t+=dbg_decl("m_vectorMorphTargetWeight",&m_m_vectorMorphTargetWeight);
	t+=dbg_decl("m_vectorVertex",&m_m_vectorVertex);
	t+=dbg_decl("m_vectorNormal",&m_m_vectorNormal);
	t+=dbg_decl("m_vectorvectorTangentSpace",&m_m_vectorvectorTangentSpace);
	t+=dbg_decl("m_vectorFace",&m_m_vectorFace);
	t+=dbg_decl("m_vectorPhysicalProperty",&m_m_vectorPhysicalProperty);
	t+=dbg_decl("m_vertexCount",&m_m_vertexCount);
	t+=dbg_decl("m_faceCount",&m_m_faceCount);
	t+=dbg_decl("m_coreMaterialId",&m_m_coreMaterialId);
	t+=dbg_decl("m_bInternalData",&m_m_bInternalData);
	return t;
}
c_CalMesh::c_CalMesh(){
	m_m_coreMesh=0;
	m_m_model=0;
	m_m_vectorSubmesh=Array<c_CalSubmesh* >();
}
c_CalCoreMesh* c_CalMesh::p_getCoreMesh2(){
	DBG_ENTER("CalMesh.getCoreMesh")
	c_CalMesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mesh.monkey<35>");
	return m_m_coreMesh;
}
c_CalMesh* c_CalMesh::m_new(){
	DBG_ENTER("CalMesh.new")
	c_CalMesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mesh.monkey<12>");
	m_m_model=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mesh.monkey<13>");
	m_m_coreMesh=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mesh.monkey<14>");
	gc_assign(m_m_vectorSubmesh,Array<c_CalSubmesh* >(0));
	return this;
}
c_CalMesh* c_CalMesh::m_new2(c_CalCoreMesh* t_coreMesh){
	DBG_ENTER("CalMesh.new")
	c_CalMesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_coreMesh,"coreMesh")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mesh.monkey<20>");
	m_m_model=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mesh.monkey<21>");
	gc_assign(m_m_coreMesh,t_coreMesh);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mesh.monkey<22>");
	gc_assign(m_m_vectorSubmesh,Array<c_CalSubmesh* >(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mesh.monkey<25>");
	Array<c_CalCoreSubmesh* > t_vectorCoreSubmesh=t_coreMesh->p_getVectorCoreSubmesh();
	DBG_LOCAL(t_vectorCoreSubmesh,"vectorCoreSubmesh")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mesh.monkey<26>");
	int t_submeshCount=t_vectorCoreSubmesh.Length();
	DBG_LOCAL(t_submeshCount,"submeshCount")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mesh.monkey<28>");
	for(int t_submeshId=0;t_submeshId<=t_submeshCount-1;t_submeshId=t_submeshId+1){
		DBG_BLOCK();
		DBG_LOCAL(t_submeshId,"submeshId")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mesh.monkey<29>");
		gc_assign(m_m_vectorSubmesh,m_m_vectorSubmesh.Resize(m_m_vectorSubmesh.Length()+1));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mesh.monkey<30>");
		gc_assign(m_m_vectorSubmesh.At(m_m_vectorSubmesh.Length()-1),(new c_CalSubmesh)->m_new2(t_vectorCoreSubmesh.At(t_submeshId)));
	}
	return this;
}
void c_CalMesh::p_setModel(c_CalModel* t_model){
	DBG_ENTER("CalMesh.setModel")
	c_CalMesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_model,"model")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mesh.monkey<78>");
	gc_assign(m_m_model,t_model);
}
c_CalSubmesh* c_CalMesh::p_getSubmesh(int t_submeshId){
	DBG_ENTER("CalMesh.getSubmesh")
	c_CalMesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_submeshId,"submeshId")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mesh.monkey<40>");
	if(t_submeshId<0 || t_submeshId>=m_m_vectorSubmesh.Length()){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mesh.monkey<41>");
		bbPrint(String(L"Invalid Submesh ID",18));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mesh.monkey<42>");
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mesh.monkey<45>");
	return m_m_vectorSubmesh.At(t_submeshId);
}
int c_CalMesh::p_getSubmeshCount2(){
	DBG_ENTER("CalMesh.getSubmeshCount")
	c_CalMesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mesh.monkey<50>");
	int t_=m_m_vectorSubmesh.Length();
	return t_;
}
Array<c_CalSubmesh* > c_CalMesh::p_getVectorSubmesh(){
	DBG_ENTER("CalMesh.getVectorSubmesh")
	c_CalMesh *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mesh.monkey<54>");
	return m_m_vectorSubmesh;
}
void c_CalMesh::mark(){
	Object::mark();
	gc_mark_q(m_m_coreMesh);
	gc_mark_q(m_m_model);
	gc_mark_q(m_m_vectorSubmesh);
}
String c_CalMesh::debug(){
	String t="(CalMesh)\n";
	t+=dbg_decl("m_model",&m_m_model);
	t+=dbg_decl("m_coreMesh",&m_m_coreMesh);
	t+=dbg_decl("m_vectorSubmesh",&m_m_vectorSubmesh);
	return t;
}
c_CalBone::c_CalBone(){
	m_m_coreBone=0;
	m_m_skeleton=0;
	m_m_accumulatedWeight=FLOAT(.0);
	m_m_accumulatedWeightAbsolute=FLOAT(.0);
	m_m_translation=0;
	m_m_rotation=0;
	m_m_translationAbsolute=0;
	m_m_rotationAbsolute=0;
	m_m_translationBoneSpace=0;
	m_m_rotationBoneSpace=0;
	m_m_transformMatrix=0;
	m_m_boundingBox=0;
}
c_CalBone* c_CalBone::m_new(){
	DBG_ENTER("CalBone.new")
	c_CalBone *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<19>");
	m_m_coreBone=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<20>");
	m_m_skeleton=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<21>");
	m_m_accumulatedWeight=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<22>");
	m_m_accumulatedWeightAbsolute=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<23>");
	gc_assign(m_m_translation,(new c_CalVector)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<24>");
	gc_assign(m_m_rotation,(new c_CalQuaternion)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<25>");
	gc_assign(m_m_translationAbsolute,(new c_CalVector)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<26>");
	gc_assign(m_m_rotationAbsolute,(new c_CalQuaternion)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<27>");
	gc_assign(m_m_translationBoneSpace,(new c_CalVector)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<28>");
	gc_assign(m_m_rotationBoneSpace,(new c_CalQuaternion)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<29>");
	gc_assign(m_m_transformMatrix,(new c_CalMatrix)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<30>");
	gc_assign(m_m_boundingBox,(new c_CalBoundingBox)->m_new());
	return this;
}
void c_CalBone::p_clearState(){
	DBG_ENTER("CalBone.clearState")
	c_CalBone *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<120>");
	m_m_accumulatedWeight=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<121>");
	m_m_accumulatedWeightAbsolute=FLOAT(0.0);
}
c_CalBone* c_CalBone::m_new2(c_CalCoreBone* t_coreBone){
	DBG_ENTER("CalBone.new")
	c_CalBone *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_coreBone,"coreBone")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<36>");
	gc_assign(m_m_coreBone,t_coreBone);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<37>");
	m_m_skeleton=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<38>");
	m_m_accumulatedWeight=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<39>");
	m_m_accumulatedWeightAbsolute=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<40>");
	gc_assign(m_m_translation,(new c_CalVector)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<41>");
	gc_assign(m_m_rotation,(new c_CalQuaternion)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<42>");
	gc_assign(m_m_translationAbsolute,(new c_CalVector)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<43>");
	gc_assign(m_m_rotationAbsolute,(new c_CalQuaternion)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<44>");
	gc_assign(m_m_translationBoneSpace,(new c_CalVector)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<45>");
	gc_assign(m_m_rotationBoneSpace,(new c_CalQuaternion)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<46>");
	gc_assign(m_m_transformMatrix,(new c_CalMatrix)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<47>");
	gc_assign(m_m_boundingBox,(new c_CalBoundingBox)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<49>");
	p_clearState();
	return this;
}
void c_CalBone::p_setSkeleton(c_CalSkeleton* t_skeleton){
	DBG_ENTER("CalBone.setSkeleton")
	c_CalBone *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_skeleton,"skeleton")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<225>");
	gc_assign(m_m_skeleton,t_skeleton);
}
c_CalMatrix* c_CalBone::p_getTransformMatrix(){
	DBG_ENTER("CalBone.getTransformMatrix")
	c_CalBone *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<195>");
	return m_m_transformMatrix;
}
c_CalVector* c_CalBone::p_getTranslationBoneSpace(){
	DBG_ENTER("CalBone.getTranslationBoneSpace")
	c_CalBone *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<191>");
	return m_m_translationBoneSpace;
}
void c_CalBone::p_blendState(Float t_weight,c_CalVector* t_translation,c_CalQuaternion* t_rotation){
	DBG_ENTER("CalBone.blendState")
	c_CalBone *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_weight,"weight")
	DBG_LOCAL(t_translation,"translation")
	DBG_LOCAL(t_rotation,"rotation")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<54>");
	if(m_m_accumulatedWeightAbsolute==FLOAT(0.0)){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<56>");
		m_m_translationAbsolute->p_assign4(t_translation);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<57>");
		m_m_rotationAbsolute->p_assign(t_rotation);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<58>");
		m_m_accumulatedWeightAbsolute=t_weight;
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<62>");
		Float t_factor=t_weight/(m_m_accumulatedWeightAbsolute+t_weight);
		DBG_LOCAL(t_factor,"factor")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<64>");
		m_m_translationAbsolute->p_blend2(t_factor,t_translation);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<65>");
		m_m_rotationAbsolute->p_blend(t_factor,t_rotation);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<66>");
		m_m_accumulatedWeightAbsolute+=t_weight;
	}
}
void c_CalBone::p_lockState(){
	DBG_ENTER("CalBone.lockState")
	c_CalBone *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<200>");
	if(m_m_accumulatedWeightAbsolute>FLOAT(1.0)-m_m_accumulatedWeight){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<201>");
		m_m_accumulatedWeightAbsolute=FLOAT(1.0)-m_m_accumulatedWeight;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<204>");
	if(m_m_accumulatedWeightAbsolute>FLOAT(0.0)){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<205>");
		if(m_m_accumulatedWeight==FLOAT(0.0)){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<207>");
			m_m_translation->p_assign4(m_m_translationAbsolute);
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<208>");
			m_m_rotation->p_assign(m_m_rotationAbsolute);
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<209>");
			m_m_accumulatedWeight=m_m_accumulatedWeightAbsolute;
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<213>");
			Float t_factor=m_m_accumulatedWeightAbsolute/(m_m_accumulatedWeight+m_m_accumulatedWeightAbsolute);
			DBG_LOCAL(t_factor,"factor")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<215>");
			m_m_translation->p_blend2(t_factor,m_m_translationAbsolute);
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<216>");
			m_m_rotation->p_blend(t_factor,m_m_rotationAbsolute);
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<217>");
			m_m_accumulatedWeight+=m_m_accumulatedWeightAbsolute;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<220>");
		m_m_accumulatedWeightAbsolute=FLOAT(0.0);
	}
}
c_CalQuaternion* c_CalBone::p_getRotationAbsolute(){
	DBG_ENTER("CalBone.getRotationAbsolute")
	c_CalBone *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<169>");
	return m_m_rotationAbsolute;
}
c_CalVector* c_CalBone::p_getTranslationAbsolute(){
	DBG_ENTER("CalBone.getTranslationAbsolute")
	c_CalBone *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<187>");
	return m_m_translationAbsolute;
}
void c_CalBone::p_calculateState(){
	DBG_ENTER("CalBone.calculateState")
	c_CalBone *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<73>");
	if(m_m_accumulatedWeight==FLOAT(0.0)){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<75>");
		m_m_translation->p_assign4(m_m_coreBone->p_getTranslation());
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<76>");
		m_m_rotation->p_assign(m_m_coreBone->p_getRotation());
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<80>");
	int t_parentId=m_m_coreBone->p_getParentId();
	DBG_LOCAL(t_parentId,"parentId")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<82>");
	if(t_parentId==-1){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<84>");
		m_m_translationAbsolute->p_assign4(m_m_translation);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<85>");
		m_m_rotationAbsolute->p_assign(m_m_rotation);
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<89>");
		c_CalBone* t_parent=m_m_skeleton->p_getBone(t_parentId);
		DBG_LOCAL(t_parent,"parent")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<92>");
		m_m_translationAbsolute->p_assign4(m_m_translation);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<93>");
		m_m_translationAbsolute->p_multQuaternionLocal(t_parent->p_getRotationAbsolute());
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<94>");
		m_m_translationAbsolute->p_addLocal(t_parent->p_getTranslationAbsolute());
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<96>");
		m_m_rotationAbsolute->p_assign(m_m_rotation);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<97>");
		m_m_rotationAbsolute->p_multQuaternionLocal(t_parent->p_getRotationAbsolute());
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<101>");
	m_m_translationBoneSpace->p_assign4(m_m_coreBone->p_getTranslationBoneSpace());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<102>");
	m_m_translationBoneSpace->p_multQuaternionLocal(m_m_rotationAbsolute);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<103>");
	m_m_translationBoneSpace->p_addLocal(m_m_translationAbsolute);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<105>");
	m_m_rotationBoneSpace->p_assign(m_m_coreBone->p_getRotationBoneSpace());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<106>");
	m_m_rotationBoneSpace->p_multQuaternionLocal(m_m_rotationAbsolute);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<110>");
	m_m_transformMatrix->p_assign(m_m_rotationBoneSpace);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<113>");
	Array<int > t_listChildId=m_m_coreBone->p_getListChildId();
	DBG_LOCAL(t_listChildId,"listChildId")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<114>");
	for(int t_iChildId=0;t_iChildId<=t_listChildId.Length()-1;t_iChildId=t_iChildId+1){
		DBG_BLOCK();
		DBG_LOCAL(t_iChildId,"iChildId")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<115>");
		m_m_skeleton->p_getBone(t_listChildId.At(t_iChildId))->p_calculateState();
	}
}
c_CalBoundingBox* c_CalBone::p_getBoundingBox(){
	DBG_ENTER("CalBone.getBoundingBox")
	c_CalBone *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/bone.monkey<273>");
	return m_m_boundingBox;
}
void c_CalBone::mark(){
	Object::mark();
	gc_mark_q(m_m_coreBone);
	gc_mark_q(m_m_skeleton);
	gc_mark_q(m_m_translation);
	gc_mark_q(m_m_rotation);
	gc_mark_q(m_m_translationAbsolute);
	gc_mark_q(m_m_rotationAbsolute);
	gc_mark_q(m_m_translationBoneSpace);
	gc_mark_q(m_m_rotationBoneSpace);
	gc_mark_q(m_m_transformMatrix);
	gc_mark_q(m_m_boundingBox);
}
String c_CalBone::debug(){
	String t="(CalBone)\n";
	t+=dbg_decl("m_coreBone",&m_m_coreBone);
	t+=dbg_decl("m_skeleton",&m_m_skeleton);
	t+=dbg_decl("m_accumulatedWeight",&m_m_accumulatedWeight);
	t+=dbg_decl("m_accumulatedWeightAbsolute",&m_m_accumulatedWeightAbsolute);
	t+=dbg_decl("m_translation",&m_m_translation);
	t+=dbg_decl("m_rotation",&m_m_rotation);
	t+=dbg_decl("m_translationAbsolute",&m_m_translationAbsolute);
	t+=dbg_decl("m_rotationAbsolute",&m_m_rotationAbsolute);
	t+=dbg_decl("m_translationBoneSpace",&m_m_translationBoneSpace);
	t+=dbg_decl("m_rotationBoneSpace",&m_m_rotationBoneSpace);
	t+=dbg_decl("m_transformMatrix",&m_m_transformMatrix);
	t+=dbg_decl("m_boundingBox",&m_m_boundingBox);
	return t;
}
c_CalMatrix::c_CalMatrix(){
	m_dxdx=FLOAT(.0);
	m_dydx=FLOAT(.0);
	m_dzdx=FLOAT(.0);
	m_dxdy=FLOAT(.0);
	m_dydy=FLOAT(.0);
	m_dzdy=FLOAT(.0);
	m_dxdz=FLOAT(.0);
	m_dydz=FLOAT(.0);
	m_dzdz=FLOAT(.0);
}
c_CalMatrix* c_CalMatrix::m_new(){
	DBG_ENTER("CalMatrix.new")
	c_CalMatrix *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<13>");
	m_dxdx=FLOAT(1.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<14>");
	m_dydx=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<15>");
	m_dzdx=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<16>");
	m_dxdy=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<17>");
	m_dydy=FLOAT(1.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<18>");
	m_dzdy=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<19>");
	m_dxdz=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<20>");
	m_dydz=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<21>");
	m_dzdz=FLOAT(1.0);
	return this;
}
c_CalMatrix* c_CalMatrix::m_new2(c_CalMatrix* t_m){
	DBG_ENTER("CalMatrix.new")
	c_CalMatrix *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_m,"m")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<29>");
	m_dxdx=FLOAT(1.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<30>");
	m_dydx=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<31>");
	m_dzdx=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<32>");
	m_dxdy=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<33>");
	m_dydy=FLOAT(1.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<34>");
	m_dzdy=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<35>");
	m_dxdz=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<36>");
	m_dydz=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<37>");
	m_dzdz=FLOAT(1.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<38>");
	m_dxdx=t_m->m_dxdx;
	m_dydx=t_m->m_dydx;
	m_dzdx=t_m->m_dzdx;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<39>");
	m_dxdy=t_m->m_dxdy;
	m_dydy=t_m->m_dydy;
	m_dzdy=t_m->m_dzdy;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<40>");
	m_dxdz=t_m->m_dxdz;
	m_dydz=t_m->m_dydz;
	m_dzdz=t_m->m_dzdz;
	return this;
}
int c_CalMatrix::p_assign(c_CalQuaternion* t_q){
	DBG_ENTER("CalMatrix.assign")
	c_CalMatrix *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_q,"q")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<44>");
	Float t_xx2=t_q->m_x*t_q->m_x*FLOAT(2.0);
	DBG_LOCAL(t_xx2,"xx2")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<45>");
	Float t_yy2=t_q->m_y*t_q->m_y*FLOAT(2.0);
	DBG_LOCAL(t_yy2,"yy2")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<46>");
	Float t_zz2=t_q->m_z*t_q->m_z*FLOAT(2.0);
	DBG_LOCAL(t_zz2,"zz2")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<47>");
	Float t_xy2=t_q->m_x*t_q->m_y*FLOAT(2.0);
	DBG_LOCAL(t_xy2,"xy2")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<48>");
	Float t_zw2=t_q->m_z*t_q->m_w*FLOAT(2.0);
	DBG_LOCAL(t_zw2,"zw2")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<49>");
	Float t_xz2=t_q->m_x*t_q->m_z*FLOAT(2.0);
	DBG_LOCAL(t_xz2,"xz2")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<50>");
	Float t_yw2=t_q->m_y*t_q->m_w*FLOAT(2.0);
	DBG_LOCAL(t_yw2,"yw2")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<51>");
	Float t_yz2=t_q->m_y*t_q->m_z*FLOAT(2.0);
	DBG_LOCAL(t_yz2,"yz2")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<52>");
	Float t_xw2=t_q->m_x*t_q->m_w*FLOAT(2.0);
	DBG_LOCAL(t_xw2,"xw2")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<53>");
	m_dxdx=FLOAT(1.0)-t_yy2-t_zz2;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<54>");
	m_dxdy=t_xy2+t_zw2;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<55>");
	m_dxdz=t_xz2-t_yw2;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<56>");
	m_dydx=t_xy2-t_zw2;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<57>");
	m_dydy=FLOAT(1.0)-t_xx2-t_zz2;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<58>");
	m_dydz=t_yz2+t_xw2;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<59>");
	m_dzdx=t_xz2+t_yw2;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<60>");
	m_dzdy=t_yz2-t_xw2;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<61>");
	m_dzdz=FLOAT(1.0)-t_xx2-t_yy2;
	return 0;
}
void c_CalMatrix::mark(){
	Object::mark();
}
String c_CalMatrix::debug(){
	String t="(CalMatrix)\n";
	t+=dbg_decl("dxdx",&m_dxdx);
	t+=dbg_decl("dydx",&m_dydx);
	t+=dbg_decl("dzdx",&m_dzdx);
	t+=dbg_decl("dxdy",&m_dxdy);
	t+=dbg_decl("dydy",&m_dydy);
	t+=dbg_decl("dzdy",&m_dzdy);
	t+=dbg_decl("dxdz",&m_dxdz);
	t+=dbg_decl("dydz",&m_dydz);
	t+=dbg_decl("dzdz",&m_dzdz);
	return t;
}
c_Enumerator14::c_Enumerator14(){
	m__list=0;
	m__curr=0;
}
c_Enumerator14* c_Enumerator14::m_new(c_List9* t_list){
	DBG_ENTER("Enumerator.new")
	c_Enumerator14 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_list,"list")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<326>");
	gc_assign(m__list,t_list);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<327>");
	gc_assign(m__curr,t_list->m__head->m__succ);
	return this;
}
c_Enumerator14* c_Enumerator14::m_new2(){
	DBG_ENTER("Enumerator.new")
	c_Enumerator14 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<323>");
	return this;
}
bool c_Enumerator14::p_HasNext(){
	DBG_ENTER("Enumerator.HasNext")
	c_Enumerator14 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<331>");
	while(m__curr->m__succ->m__pred!=m__curr){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<332>");
		gc_assign(m__curr,m__curr->m__succ);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<334>");
	bool t_=m__curr!=m__list->m__head;
	return t_;
}
c_Cal3dB3dMesh* c_Enumerator14::p_NextObject(){
	DBG_ENTER("Enumerator.NextObject")
	c_Enumerator14 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<338>");
	c_Cal3dB3dMesh* t_data=m__curr->m__data;
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<339>");
	gc_assign(m__curr,m__curr->m__succ);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<340>");
	return t_data;
}
void c_Enumerator14::mark(){
	Object::mark();
	gc_mark_q(m__list);
	gc_mark_q(m__curr);
}
String c_Enumerator14::debug(){
	String t="(Enumerator)\n";
	t+=dbg_decl("_list",&m__list);
	t+=dbg_decl("_curr",&m__curr);
	return t;
}
c_CalTangentSpace::c_CalTangentSpace(){
	m_tangent=0;
	m_crossFactor=FLOAT(.0);
}
c_CalTangentSpace* c_CalTangentSpace::m_new(){
	DBG_ENTER("CalTangentSpace.new")
	c_CalTangentSpace *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<362>");
	gc_assign(m_tangent,(new c_CalVector)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<363>");
	m_crossFactor=FLOAT(0.0);
	return this;
}
c_CalTangentSpace* c_CalTangentSpace::m_new2(c_CalVector* t_t,Float t_c){
	DBG_ENTER("CalTangentSpace.new")
	c_CalTangentSpace *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_t,"t")
	DBG_LOCAL(t_c,"c")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<368>");
	gc_assign(m_tangent,(new c_CalVector)->m_new2(t_t));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<369>");
	m_crossFactor=t_c;
	return this;
}
c_CalTangentSpace* c_CalTangentSpace::m_new3(Float t_xx,Float t_yy,Float t_zz,Float t_c){
	DBG_ENTER("CalTangentSpace.new")
	c_CalTangentSpace *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_xx,"xx")
	DBG_LOCAL(t_yy,"yy")
	DBG_LOCAL(t_zz,"zz")
	DBG_LOCAL(t_c,"c")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<374>");
	gc_assign(m_tangent,(new c_CalVector)->m_new3(t_xx,t_yy,t_zz));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<375>");
	m_crossFactor=t_c;
	return this;
}
void c_CalTangentSpace::mark(){
	Object::mark();
	gc_mark_q(m_tangent);
}
String c_CalTangentSpace::debug(){
	String t="(CalTangentSpace)\n";
	t+=dbg_decl("tangent",&m_tangent);
	t+=dbg_decl("crossFactor",&m_crossFactor);
	return t;
}
c_CalFace::c_CalFace(){
	m_vertexId=Array<int >(3);
}
c_CalFace* c_CalFace::m_new(){
	DBG_ENTER("CalFace.new")
	c_CalFace *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<506>");
	m_vertexId.At(0)=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<507>");
	m_vertexId.At(1)=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<508>");
	m_vertexId.At(2)=0;
	return this;
}
c_CalFace* c_CalFace::m_new2(int t_v1,int t_v2,int t_v3){
	DBG_ENTER("CalFace.new")
	c_CalFace *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_v1,"v1")
	DBG_LOCAL(t_v2,"v2")
	DBG_LOCAL(t_v3,"v3")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<514>");
	m_vertexId.At(0)=t_v1;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<515>");
	m_vertexId.At(1)=t_v2;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<516>");
	m_vertexId.At(2)=t_v3;
	return this;
}
c_CalFace* c_CalFace::m_new3(c_CalFace* t_f){
	DBG_ENTER("CalFace.new")
	c_CalFace *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_f,"f")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<522>");
	m_vertexId.At(0)=t_f->m_vertexId.At(0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<523>");
	m_vertexId.At(1)=t_f->m_vertexId.At(1);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<524>");
	m_vertexId.At(2)=t_f->m_vertexId.At(2);
	return this;
}
c_CalFace* c_CalFace::m_new4(Array<int > t_vi){
	DBG_ENTER("CalFace.new")
	c_CalFace *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_vi,"vi")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<530>");
	m_vertexId.At(0)=t_vi.At(0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<531>");
	m_vertexId.At(1)=t_vi.At(1);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<532>");
	m_vertexId.At(2)=t_vi.At(2);
	return this;
}
void c_CalFace::mark(){
	Object::mark();
	gc_mark_q(m_vertexId);
}
String c_CalFace::debug(){
	String t="(CalFace)\n";
	t+=dbg_decl("vertexId",&m_vertexId);
	return t;
}
c_CalPhysicalProperty::c_CalPhysicalProperty(){
	m_weight=FLOAT(.0);
	m_position=0;
	m_positionOld=0;
	m_force=0;
}
c_CalPhysicalProperty* c_CalPhysicalProperty::m_new(){
	DBG_ENTER("CalPhysicalProperty.new")
	c_CalPhysicalProperty *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<411>");
	m_weight=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<412>");
	gc_assign(m_position,(new c_CalVector)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<413>");
	gc_assign(m_positionOld,(new c_CalVector)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<414>");
	gc_assign(m_force,(new c_CalVector)->m_new());
	return this;
}
c_CalPhysicalProperty* c_CalPhysicalProperty::m_new2(Float t_w){
	DBG_ENTER("CalPhysicalProperty.new")
	c_CalPhysicalProperty *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_w,"w")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<420>");
	m_weight=t_w;
	return this;
}
c_CalPhysicalProperty* c_CalPhysicalProperty::m_new3(c_CalVector* t_p,c_CalVector* t_o,c_CalVector* t_f,Float t_w){
	DBG_ENTER("CalPhysicalProperty.new")
	c_CalPhysicalProperty *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_p,"p")
	DBG_LOCAL(t_o,"o")
	DBG_LOCAL(t_f,"f")
	DBG_LOCAL(t_w,"w")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<426>");
	m_weight=t_w;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<427>");
	gc_assign(m_position,t_p);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<428>");
	gc_assign(m_positionOld,t_o);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<429>");
	gc_assign(m_force,t_f);
	return this;
}
void c_CalPhysicalProperty::mark(){
	Object::mark();
	gc_mark_q(m_position);
	gc_mark_q(m_positionOld);
	gc_mark_q(m_force);
}
String c_CalPhysicalProperty::debug(){
	String t="(CalPhysicalProperty)\n";
	t+=dbg_decl("weight",&m_weight);
	t+=dbg_decl("position",&m_position);
	t+=dbg_decl("positionOld",&m_positionOld);
	t+=dbg_decl("force",&m_force);
	return t;
}
c_CalCoreSubMorphTarget::c_CalCoreSubMorphTarget(){
	m_m_vectorBlendVertex=Array<c_CalBlendVertex* >();
}
Array<c_CalBlendVertex* > c_CalCoreSubMorphTarget::p_getVectorBlendVertex(){
	DBG_ENTER("CalCoreSubMorphTarget.getVectorBlendVertex")
	c_CalCoreSubMorphTarget *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmorphtarget.monkey<22>");
	return m_m_vectorBlendVertex;
}
void c_CalCoreSubMorphTarget::mark(){
	Object::mark();
	gc_mark_q(m_m_vectorBlendVertex);
}
String c_CalCoreSubMorphTarget::debug(){
	String t="(CalCoreSubMorphTarget)\n";
	t+=dbg_decl("m_vectorBlendVertex",&m_m_vectorBlendVertex);
	return t;
}
c_CalBlendVertex::c_CalBlendVertex(){
	m_position=0;
	m_normal=0;
}
void c_CalBlendVertex::mark(){
	Object::mark();
	gc_mark_q(m_position);
	gc_mark_q(m_normal);
}
String c_CalBlendVertex::debug(){
	String t="(CalBlendVertex)\n";
	t+=dbg_decl("position",&m_position);
	t+=dbg_decl("normal",&m_normal);
	return t;
}
c_NormHelperClass::c_NormHelperClass(){
	m_vec=0;
	m_vert=0;
}
c_NormHelperClass* c_NormHelperClass::m_new(){
	DBG_ENTER("NormHelperClass.new")
	c_NormHelperClass *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<978>");
	return this;
}
void c_NormHelperClass::mark(){
	Object::mark();
	gc_mark_q(m_vec);
}
String c_NormHelperClass::debug(){
	String t="(NormHelperClass)\n";
	t+=dbg_decl("vec",&m_vec);
	t+=dbg_decl("vert",&m_vert);
	return t;
}
c_Map5::c_Map5(){
	m_root=0;
}
c_Map5* c_Map5::m_new(){
	DBG_ENTER("Map.new")
	c_Map5 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<7>");
	return this;
}
c_Node15* c_Map5::p_FindNode3(c_Vector* t_key){
	DBG_ENTER("Map.FindNode")
	c_Map5 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_key,"key")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<157>");
	c_Node15* t_node=m_root;
	DBG_LOCAL(t_node,"node")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<159>");
	while((t_node)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<160>");
		int t_cmp=p_Compare4(t_key,t_node->m_key);
		DBG_LOCAL(t_cmp,"cmp")
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<161>");
		if(t_cmp>0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<162>");
			t_node=t_node->m_right;
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<163>");
			if(t_cmp<0){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<164>");
				t_node=t_node->m_left;
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<166>");
				return t_node;
			}
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<169>");
	return t_node;
}
c_NormHelperClass* c_Map5::p_Get3(c_Vector* t_key){
	DBG_ENTER("Map.Get")
	c_Map5 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_key,"key")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<101>");
	c_Node15* t_node=p_FindNode3(t_key);
	DBG_LOCAL(t_node,"node")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<102>");
	if((t_node)!=0){
		DBG_BLOCK();
		return t_node->m_value;
	}
	return 0;
}
int c_Map5::p_RotateLeft3(c_Node15* t_node){
	DBG_ENTER("Map.RotateLeft")
	c_Map5 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_node,"node")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<251>");
	c_Node15* t_child=t_node->m_right;
	DBG_LOCAL(t_child,"child")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<252>");
	gc_assign(t_node->m_right,t_child->m_left);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<253>");
	if((t_child->m_left)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<254>");
		gc_assign(t_child->m_left->m_parent,t_node);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<256>");
	gc_assign(t_child->m_parent,t_node->m_parent);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<257>");
	if((t_node->m_parent)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<258>");
		if(t_node==t_node->m_parent->m_left){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<259>");
			gc_assign(t_node->m_parent->m_left,t_child);
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<261>");
			gc_assign(t_node->m_parent->m_right,t_child);
		}
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<264>");
		gc_assign(m_root,t_child);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<266>");
	gc_assign(t_child->m_left,t_node);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<267>");
	gc_assign(t_node->m_parent,t_child);
	return 0;
}
int c_Map5::p_RotateRight3(c_Node15* t_node){
	DBG_ENTER("Map.RotateRight")
	c_Map5 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_node,"node")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<271>");
	c_Node15* t_child=t_node->m_left;
	DBG_LOCAL(t_child,"child")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<272>");
	gc_assign(t_node->m_left,t_child->m_right);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<273>");
	if((t_child->m_right)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<274>");
		gc_assign(t_child->m_right->m_parent,t_node);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<276>");
	gc_assign(t_child->m_parent,t_node->m_parent);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<277>");
	if((t_node->m_parent)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<278>");
		if(t_node==t_node->m_parent->m_right){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<279>");
			gc_assign(t_node->m_parent->m_right,t_child);
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<281>");
			gc_assign(t_node->m_parent->m_left,t_child);
		}
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<284>");
		gc_assign(m_root,t_child);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<286>");
	gc_assign(t_child->m_right,t_node);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<287>");
	gc_assign(t_node->m_parent,t_child);
	return 0;
}
int c_Map5::p_InsertFixup3(c_Node15* t_node){
	DBG_ENTER("Map.InsertFixup")
	c_Map5 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_node,"node")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<212>");
	while(((t_node->m_parent)!=0) && t_node->m_parent->m_color==-1 && ((t_node->m_parent->m_parent)!=0)){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<213>");
		if(t_node->m_parent==t_node->m_parent->m_parent->m_left){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<214>");
			c_Node15* t_uncle=t_node->m_parent->m_parent->m_right;
			DBG_LOCAL(t_uncle,"uncle")
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<215>");
			if(((t_uncle)!=0) && t_uncle->m_color==-1){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<216>");
				t_node->m_parent->m_color=1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<217>");
				t_uncle->m_color=1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<218>");
				t_uncle->m_parent->m_color=-1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<219>");
				t_node=t_uncle->m_parent;
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<221>");
				if(t_node==t_node->m_parent->m_right){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<222>");
					t_node=t_node->m_parent;
					DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<223>");
					p_RotateLeft3(t_node);
				}
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<225>");
				t_node->m_parent->m_color=1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<226>");
				t_node->m_parent->m_parent->m_color=-1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<227>");
				p_RotateRight3(t_node->m_parent->m_parent);
			}
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<230>");
			c_Node15* t_uncle2=t_node->m_parent->m_parent->m_left;
			DBG_LOCAL(t_uncle2,"uncle")
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<231>");
			if(((t_uncle2)!=0) && t_uncle2->m_color==-1){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<232>");
				t_node->m_parent->m_color=1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<233>");
				t_uncle2->m_color=1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<234>");
				t_uncle2->m_parent->m_color=-1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<235>");
				t_node=t_uncle2->m_parent;
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<237>");
				if(t_node==t_node->m_parent->m_left){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<238>");
					t_node=t_node->m_parent;
					DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<239>");
					p_RotateRight3(t_node);
				}
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<241>");
				t_node->m_parent->m_color=1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<242>");
				t_node->m_parent->m_parent->m_color=-1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<243>");
				p_RotateLeft3(t_node->m_parent->m_parent);
			}
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<247>");
	m_root->m_color=1;
	return 0;
}
bool c_Map5::p_Set3(c_Vector* t_key,c_NormHelperClass* t_value){
	DBG_ENTER("Map.Set")
	c_Map5 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_key,"key")
	DBG_LOCAL(t_value,"value")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<29>");
	c_Node15* t_node=m_root;
	DBG_LOCAL(t_node,"node")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<30>");
	c_Node15* t_parent=0;
	int t_cmp=0;
	DBG_LOCAL(t_parent,"parent")
	DBG_LOCAL(t_cmp,"cmp")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<32>");
	while((t_node)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<33>");
		t_parent=t_node;
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<34>");
		t_cmp=p_Compare4(t_key,t_node->m_key);
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<35>");
		if(t_cmp>0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<36>");
			t_node=t_node->m_right;
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<37>");
			if(t_cmp<0){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<38>");
				t_node=t_node->m_left;
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<40>");
				gc_assign(t_node->m_value,t_value);
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<41>");
				return false;
			}
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<45>");
	t_node=(new c_Node15)->m_new(t_key,t_value,-1,t_parent);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<47>");
	if((t_parent)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<48>");
		if(t_cmp>0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<49>");
			gc_assign(t_parent->m_right,t_node);
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<51>");
			gc_assign(t_parent->m_left,t_node);
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<53>");
		p_InsertFixup3(t_node);
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<55>");
		gc_assign(m_root,t_node);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<57>");
	return true;
}
void c_Map5::mark(){
	Object::mark();
	gc_mark_q(m_root);
}
String c_Map5::debug(){
	String t="(Map)\n";
	t+=dbg_decl("root",&m_root);
	return t;
}
c_NormMap::c_NormMap(){
}
c_NormMap* c_NormMap::m_new(){
	DBG_ENTER("NormMap.new")
	c_NormMap *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<967>");
	c_Map5::m_new();
	return this;
}
int c_NormMap::p_Compare4(c_Vector* t_lhs,c_Vector* t_rhs){
	DBG_ENTER("NormMap.Compare")
	c_NormMap *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_lhs,"lhs")
	DBG_LOCAL(t_rhs,"rhs")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<969>");
	if(t_lhs->m_x<t_rhs->m_x){
		DBG_BLOCK();
		return -1;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<970>");
	if(t_lhs->m_x>t_rhs->m_x){
		DBG_BLOCK();
		return 1;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<971>");
	if(t_lhs->m_y<t_rhs->m_y){
		DBG_BLOCK();
		return -1;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<972>");
	if(t_lhs->m_y>t_rhs->m_y){
		DBG_BLOCK();
		return 1;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<973>");
	if(t_lhs->m_z<t_rhs->m_z){
		DBG_BLOCK();
		return -1;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tsurface.monkey<974>");
	int t_=((t_lhs->m_z>t_rhs->m_z)?1:0);
	return t_;
}
void c_NormMap::mark(){
	c_Map5::mark();
}
String c_NormMap::debug(){
	String t="(NormMap)\n";
	t=c_Map5::debug()+t;
	return t;
}
c_Node15::c_Node15(){
	m_key=0;
	m_right=0;
	m_left=0;
	m_value=0;
	m_color=0;
	m_parent=0;
}
c_Node15* c_Node15::m_new(c_Vector* t_key,c_NormHelperClass* t_value,int t_color,c_Node15* t_parent){
	DBG_ENTER("Node.new")
	c_Node15 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_key,"key")
	DBG_LOCAL(t_value,"value")
	DBG_LOCAL(t_color,"color")
	DBG_LOCAL(t_parent,"parent")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<364>");
	gc_assign(this->m_key,t_key);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<365>");
	gc_assign(this->m_value,t_value);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<366>");
	this->m_color=t_color;
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<367>");
	gc_assign(this->m_parent,t_parent);
	return this;
}
c_Node15* c_Node15::m_new2(){
	DBG_ENTER("Node.new")
	c_Node15 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<361>");
	return this;
}
void c_Node15::mark(){
	Object::mark();
	gc_mark_q(m_key);
	gc_mark_q(m_right);
	gc_mark_q(m_left);
	gc_mark_q(m_value);
	gc_mark_q(m_parent);
}
String c_Node15::debug(){
	String t="(Node)\n";
	t+=dbg_decl("key",&m_key);
	t+=dbg_decl("value",&m_value);
	t+=dbg_decl("color",&m_color);
	t+=dbg_decl("parent",&m_parent);
	t+=dbg_decl("left",&m_left);
	t+=dbg_decl("right",&m_right);
	return t;
}
c_CalCoreTrack::c_CalCoreTrack(){
	m_m_keyframes=Array<c_CalCoreKeyframe* >();
	m_m_coreBoneId=0;
}
int c_CalCoreTrack::p_getCoreKeyframeCount(){
	DBG_ENTER("CalCoreTrack.getCoreKeyframeCount")
	c_CalCoreTrack *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<80>");
	int t_=m_m_keyframes.Length();
	return t_;
}
c_CalCoreKeyframe* c_CalCoreTrack::p_getCoreKeyframe(int t_index){
	DBG_ENTER("CalCoreTrack.getCoreKeyframe")
	c_CalCoreTrack *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_index,"index")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<84>");
	return m_m_keyframes.At(t_index);
}
bool c_CalCoreTrack::p_addCoreKeyframe(c_CalCoreKeyframe* t_coreKeyframe){
	DBG_ENTER("CalCoreTrack.addCoreKeyframe")
	c_CalCoreTrack *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_coreKeyframe,"coreKeyframe")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<89>");
	gc_assign(m_m_keyframes,m_m_keyframes.Resize(m_m_keyframes.Length()+1));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<90>");
	gc_assign(m_m_keyframes.At(m_m_keyframes.Length()-1),t_coreKeyframe);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<91>");
	int t_index=m_m_keyframes.Length()-1;
	DBG_LOCAL(t_index,"index")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<93>");
	while(t_index>0 && m_m_keyframes.At(t_index)->p_getTime()<m_m_keyframes.At(t_index-1)->p_getTime()){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<95>");
		c_CalCoreKeyframe* t_temp=m_m_keyframes.At(t_index);
		DBG_LOCAL(t_temp,"temp")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<96>");
		gc_assign(m_m_keyframes.At(t_index),m_m_keyframes.At(t_index-1));
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<97>");
		gc_assign(m_m_keyframes.At(t_index-1),t_temp);
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<98>");
		t_index=t_index-1;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<102>");
	return true;
}
int c_CalCoreTrack::p_getCoreBoneId2(){
	DBG_ENTER("CalCoreTrack.getCoreBoneId")
	c_CalCoreTrack *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<70>");
	return m_m_coreBoneId;
}
int c_CalCoreTrack::p_getUpperBound(Float t_time){
	DBG_ENTER("CalCoreTrack.getUpperBound")
	c_CalCoreTrack *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_time,"time")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<129>");
	int t_lower=0;
	DBG_LOCAL(t_lower,"lower")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<130>");
	int t_upper=m_m_keyframes.Length()-1;
	DBG_LOCAL(t_upper,"upper")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<132>");
	while(t_lower<t_upper-1){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<133>");
		int t_middle=t_lower+t_upper>>1;
		DBG_LOCAL(t_middle,"middle")
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<135>");
		if(t_time>=m_m_keyframes.At(t_middle)->p_getTime()){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<136>");
			t_lower=t_middle;
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<139>");
			t_upper=t_middle;
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<143>");
	return t_upper;
}
bool c_CalCoreTrack::p_getState2(Float t_time,c_CalVector* t_translation,c_CalQuaternion* t_rotation){
	DBG_ENTER("CalCoreTrack.getState")
	c_CalCoreTrack *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_time,"time")
	DBG_LOCAL(t_translation,"translation")
	DBG_LOCAL(t_rotation,"rotation")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<25>");
	int t_coreKeyframeIdBefore=0;
	int t_coreKeyframeIdAfter=0;
	DBG_LOCAL(t_coreKeyframeIdBefore,"coreKeyframeIdBefore")
	DBG_LOCAL(t_coreKeyframeIdAfter,"coreKeyframeIdAfter")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<28>");
	t_coreKeyframeIdAfter=p_getUpperBound(t_time);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<31>");
	if(t_coreKeyframeIdAfter==m_m_keyframes.Length()){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<33>");
		t_coreKeyframeIdAfter=t_coreKeyframeIdAfter-1;
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<34>");
		t_rotation->p_assign(m_m_keyframes.At(t_coreKeyframeIdAfter)->p_getRotation());
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<35>");
		t_translation->p_assign4(m_m_keyframes.At(t_coreKeyframeIdAfter)->p_getTranslation());
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<36>");
		return true;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<40>");
	if(t_coreKeyframeIdAfter==0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<42>");
		t_rotation->p_assign(m_m_keyframes.At(t_coreKeyframeIdAfter)->p_getRotation());
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<43>");
		t_translation->p_assign4(m_m_keyframes.At(t_coreKeyframeIdAfter)->p_getTranslation());
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<44>");
		return true;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<48>");
	t_coreKeyframeIdBefore=t_coreKeyframeIdAfter-1;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<51>");
	c_CalCoreKeyframe* t_coreKeyframeBefore=0;
	c_CalCoreKeyframe* t_coreKeyframeAfter=0;
	DBG_LOCAL(t_coreKeyframeBefore,"coreKeyframeBefore")
	DBG_LOCAL(t_coreKeyframeAfter,"coreKeyframeAfter")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<52>");
	t_coreKeyframeBefore=m_m_keyframes.At(t_coreKeyframeIdBefore);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<53>");
	t_coreKeyframeAfter=m_m_keyframes.At(t_coreKeyframeIdAfter);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<56>");
	Float t_blendFactor=(t_time-t_coreKeyframeBefore->p_getTime())/(t_coreKeyframeAfter->p_getTime()-t_coreKeyframeBefore->p_getTime());
	DBG_LOCAL(t_blendFactor,"blendFactor")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<59>");
	t_translation->p_assign4(t_coreKeyframeBefore->p_getTranslation());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<60>");
	t_translation->p_blend2(t_blendFactor,t_coreKeyframeAfter->p_getTranslation());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<62>");
	t_rotation->p_assign(t_coreKeyframeBefore->p_getRotation());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<63>");
	t_rotation->p_blend(t_blendFactor,t_coreKeyframeAfter->p_getRotation());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<65>");
	return true;
}
c_CalCoreTrack* c_CalCoreTrack::m_new(){
	DBG_ENTER("CalCoreTrack.new")
	c_CalCoreTrack *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<10>");
	m_m_coreBoneId=-1;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<11>");
	gc_assign(m_m_keyframes,Array<c_CalCoreKeyframe* >(0));
	return this;
}
bool c_CalCoreTrack::p_setCoreBoneId(int t_coreBoneId){
	DBG_ENTER("CalCoreTrack.setCoreBoneId")
	c_CalCoreTrack *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_coreBoneId,"coreBoneId")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<74>");
	if(t_coreBoneId<0){
		DBG_BLOCK();
		return false;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<75>");
	m_m_coreBoneId=t_coreBoneId;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coretrack.monkey<76>");
	return true;
}
void c_CalCoreTrack::mark(){
	Object::mark();
	gc_mark_q(m_m_keyframes);
}
String c_CalCoreTrack::debug(){
	String t="(CalCoreTrack)\n";
	t+=dbg_decl("m_coreBoneId",&m_m_coreBoneId);
	t+=dbg_decl("m_keyframes",&m_m_keyframes);
	return t;
}
c_CalCoreKeyframe::c_CalCoreKeyframe(){
	m_m_time=FLOAT(.0);
	m_m_translation=0;
	m_m_rotation=0;
}
Float c_CalCoreKeyframe::p_getTime(){
	DBG_ENTER("CalCoreKeyframe.getTime")
	c_CalCoreKeyframe *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corekeyframe.monkey<46>");
	return m_m_time;
}
c_CalCoreKeyframe* c_CalCoreKeyframe::m_new(){
	DBG_ENTER("CalCoreKeyframe.new")
	c_CalCoreKeyframe *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corekeyframe.monkey<11>");
	m_m_time=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corekeyframe.monkey<12>");
	gc_assign(m_m_translation,(new c_CalVector)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corekeyframe.monkey<13>");
	gc_assign(m_m_rotation,(new c_CalQuaternion)->m_new());
	return this;
}
c_CalCoreKeyframe* c_CalCoreKeyframe::m_new2(Float t_time,c_CalVector* t_t,c_CalQuaternion* t_r){
	DBG_ENTER("CalCoreKeyframe.new")
	c_CalCoreKeyframe *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_time,"time")
	DBG_LOCAL(t_t,"t")
	DBG_LOCAL(t_r,"r")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corekeyframe.monkey<18>");
	m_m_time=t_time;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corekeyframe.monkey<19>");
	gc_assign(m_m_translation,(new c_CalVector)->m_new2(t_t));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corekeyframe.monkey<20>");
	gc_assign(m_m_rotation,(new c_CalQuaternion)->m_new2(t_r));
	return this;
}
c_CalVector* c_CalCoreKeyframe::p_getTranslation(){
	DBG_ENTER("CalCoreKeyframe.getTranslation")
	c_CalCoreKeyframe *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corekeyframe.monkey<40>");
	return m_m_translation;
}
void c_CalCoreKeyframe::p_setTranslation(c_CalVector* t_translation){
	DBG_ENTER("CalCoreKeyframe.setTranslation")
	c_CalCoreKeyframe *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_translation,"translation")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corekeyframe.monkey<54>");
	m_m_translation->p_assign4(t_translation);
}
c_CalQuaternion* c_CalCoreKeyframe::p_getRotation(){
	DBG_ENTER("CalCoreKeyframe.getRotation")
	c_CalCoreKeyframe *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corekeyframe.monkey<34>");
	return m_m_rotation;
}
void c_CalCoreKeyframe::p_setRotation(c_CalQuaternion* t_rotation){
	DBG_ENTER("CalCoreKeyframe.setRotation")
	c_CalCoreKeyframe *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_rotation,"rotation")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corekeyframe.monkey<50>");
	m_m_rotation->p_assign(t_rotation);
}
void c_CalCoreKeyframe::p_setTime(Float t_time){
	DBG_ENTER("CalCoreKeyframe.setTime")
	c_CalCoreKeyframe *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_time,"time")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/corekeyframe.monkey<58>");
	m_m_time=t_time;
}
void c_CalCoreKeyframe::mark(){
	Object::mark();
	gc_mark_q(m_m_translation);
	gc_mark_q(m_m_rotation);
}
String c_CalCoreKeyframe::debug(){
	String t="(CalCoreKeyframe)\n";
	t+=dbg_decl("m_time",&m_m_time);
	t+=dbg_decl("m_translation",&m_m_translation);
	t+=dbg_decl("m_rotation",&m_m_rotation);
	return t;
}
void bb_mixer_addExtraKeyframeForLoopedAnim(c_CalCoreAnimation* t_coreAnimation){
	DBG_ENTER("addExtraKeyframeForLoopedAnim")
	DBG_LOCAL(t_coreAnimation,"coreAnimation")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<435>");
	Array<c_CalCoreTrack* > t_listCoreTrack=t_coreAnimation->p_getListCoreTrack();
	DBG_LOCAL(t_listCoreTrack,"listCoreTrack")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<436>");
	if(t_listCoreTrack.Length()==0){
		DBG_BLOCK();
		return;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<440>");
	int t_coreTrackId=0;
	DBG_LOCAL(t_coreTrackId,"coreTrackId")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<441>");
	if(t_listCoreTrack.At(t_coreTrackId)==0){
		DBG_BLOCK();
		return;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<444>");
	c_CalCoreKeyframe* t_lastKeyframe=t_listCoreTrack.At(t_coreTrackId)->p_getCoreKeyframe(t_listCoreTrack.At(t_coreTrackId)->p_getCoreKeyframeCount()-1);
	DBG_LOCAL(t_lastKeyframe,"lastKeyframe")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<445>");
	if(t_lastKeyframe==0){
		DBG_BLOCK();
		return;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<448>");
	if(t_lastKeyframe->p_getTime()<t_coreAnimation->p_getDuration()){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<449>");
		for(t_coreTrackId=0;t_coreTrackId<=t_listCoreTrack.Length()-1;t_coreTrackId=t_coreTrackId+1){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<450>");
			c_CalCoreTrack* t_coreTrack=t_listCoreTrack.At(t_coreTrackId);
			DBG_LOCAL(t_coreTrack,"coreTrack")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<452>");
			c_CalCoreKeyframe* t_firstKeyframe=t_coreTrack->p_getCoreKeyframe(0);
			DBG_LOCAL(t_firstKeyframe,"firstKeyframe")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<453>");
			c_CalCoreKeyframe* t_newKeyframe=(new c_CalCoreKeyframe)->m_new();
			DBG_LOCAL(t_newKeyframe,"newKeyframe")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<455>");
			t_newKeyframe->p_setTranslation(t_firstKeyframe->p_getTranslation());
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<456>");
			t_newKeyframe->p_setRotation(t_firstKeyframe->p_getRotation());
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<457>");
			t_newKeyframe->p_setTime(t_coreAnimation->p_getDuration());
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/mixer.monkey<459>");
			t_coreTrack->p_addCoreKeyframe(t_newKeyframe);
		}
	}
}
c_CalCallbackRecord::c_CalCallbackRecord(){
	m_callback=0;
	m_min_interval=FLOAT(.0);
}
void c_CalCallbackRecord::mark(){
	Object::mark();
	gc_mark_q(m_callback);
}
String c_CalCallbackRecord::debug(){
	String t="(CalCallbackRecord)\n";
	t+=dbg_decl("callback",&m_callback);
	t+=dbg_decl("min_interval",&m_min_interval);
	return t;
}
c_CalAnimationType::c_CalAnimationType(){
}
void c_CalAnimationType::mark(){
	Object::mark();
}
String c_CalAnimationType::debug(){
	String t="(CalAnimationType)\n";
	return t;
}
c_CalAnimationState::c_CalAnimationState(){
}
void c_CalAnimationState::mark(){
	Object::mark();
}
String c_CalAnimationState::debug(){
	String t="(CalAnimationState)\n";
	return t;
}
c_CalAnimationCallback::c_CalAnimationCallback(){
}
void c_CalAnimationCallback::p_AnimationUpdate(Float t_anim_time,c_CalModel* t_model,Object* t_userData){
	DBG_ENTER("CalAnimationCallback.AnimationUpdate")
	c_CalAnimationCallback *self=this;
	DBG_LOCAL(self,"Self")
}
void c_CalAnimationCallback::p_AnimationComplete(c_CalModel* t_model,Object* t_userData){
	DBG_ENTER("CalAnimationCallback.AnimationComplete")
	c_CalAnimationCallback *self=this;
	DBG_LOCAL(self,"Self")
}
void c_CalAnimationCallback::mark(){
	c_CalCallbackRecord::mark();
}
String c_CalAnimationCallback::debug(){
	String t="(CalAnimationCallback)\n";
	t=c_CalCallbackRecord::debug()+t;
	return t;
}
Float bb_animation_Modf(Float t_a,Float t_n){
	DBG_ENTER("Modf")
	DBG_LOCAL(t_a,"a")
	DBG_LOCAL(t_n,"n")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<339>");
	Float t_ret=t_a-t_n*(Float)floor(t_a/t_n);
	DBG_LOCAL(t_ret,"ret")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/animation.monkey<340>");
	return t_ret;
}
c_CalVector* bb_math_vectorScalarMult(c_CalVector* t_v,Float t_d){
	DBG_ENTER("vectorScalarMult")
	DBG_LOCAL(t_v,"v")
	DBG_LOCAL(t_d,"d")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<476>");
	c_CalVector* t_=(new c_CalVector)->m_new3(t_v->m_x*t_d,t_v->m_y*t_d,t_v->m_z*t_d);
	return t_;
}
c_CalVector* bb_math_vectorSub(c_CalVector* t_v0,c_CalVector* t_v1){
	DBG_ENTER("vectorSub")
	DBG_LOCAL(t_v0,"v0")
	DBG_LOCAL(t_v1,"v1")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<464>");
	c_CalVector* t_=(new c_CalVector)->m_new3(t_v0->m_x-t_v1->m_x,t_v0->m_y-t_v1->m_y,t_v0->m_z-t_v1->m_z);
	return t_;
}
c_CalVector* bb_math_vectorSub2(c_CalVertex* t_v0,c_CalVertex* t_v1){
	DBG_ENTER("vectorSub")
	DBG_LOCAL(t_v0,"v0")
	DBG_LOCAL(t_v1,"v1")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/math.monkey<470>");
	c_CalVector* t_=(new c_CalVector)->m_new3(t_v0->m_position->m_x-t_v1->m_position->m_x,t_v0->m_position->m_y-t_v1->m_position->m_y,t_v0->m_position->m_z-t_v1->m_position->m_z);
	return t_;
}
c_CalTextureCoordinate::c_CalTextureCoordinate(){
	m_u=FLOAT(.0);
	m_v=FLOAT(.0);
}
c_CalTextureCoordinate* c_CalTextureCoordinate::m_new(){
	DBG_ENTER("CalTextureCoordinate.new")
	c_CalTextureCoordinate *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<335>");
	m_u=FLOAT(0.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<336>");
	m_v=FLOAT(0.0);
	return this;
}
c_CalTextureCoordinate* c_CalTextureCoordinate::m_new2(c_CalTextureCoordinate* t_uv){
	DBG_ENTER("CalTextureCoordinate.new")
	c_CalTextureCoordinate *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_uv,"uv")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<341>");
	m_u=t_uv->m_u;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<342>");
	m_v=t_uv->m_v;
	return this;
}
c_CalTextureCoordinate* c_CalTextureCoordinate::m_new3(Float t_uu,Float t_vv){
	DBG_ENTER("CalTextureCoordinate.new")
	c_CalTextureCoordinate *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_uu,"uu")
	DBG_LOCAL(t_vv,"vv")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<347>");
	m_u=t_uu;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/coresubmesh.monkey<348>");
	m_v=t_vv;
	return this;
}
void c_CalTextureCoordinate::mark(){
	Object::mark();
}
String c_CalTextureCoordinate::debug(){
	String t="(CalTextureCoordinate)\n";
	t+=dbg_decl("u",&m_u);
	t+=dbg_decl("v",&m_v);
	return t;
}
c_CalImage::c_CalImage(){
	m_finished=false;
	m_pos=0;
	m_pixels=Array<String >();
	m_posx=0;
	m_posy=0;
	m_tex=0;
	m_w=0;
	m_h=0;
	m_texture=0;
}
bool c_CalImage::p_IsFinished(){
	DBG_ENTER("CalImage.IsFinished")
	c_CalImage *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calimage.monkey<45>");
	return m_finished;
}
c_TTexture* c_CalImage::p_MakeTexture(){
	DBG_ENTER("CalImage.MakeTexture")
	c_CalImage *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calimage.monkey<38>");
	bbPrint(String(L"Create Texture",14));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calimage.monkey<39>");
	gc_assign(m_texture,c_TTexture::m_CreateTexture(m_w,m_h,9,1,0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calimage.monkey<40>");
	gc_assign(m_texture->m_pixmap,m_tex);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calimage.monkey<41>");
	return m_texture;
}
void c_CalImage::p_Update(){
	DBG_ENTER("CalImage.Update")
	c_CalImage *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calimage.monkey<50>");
	if(m_finished==false){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calimage.monkey<52>");
		for(int t_i=0;t_i<=255;t_i=t_i+1){
			DBG_BLOCK();
			DBG_LOCAL(t_i,"i")
			DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calimage.monkey<53>");
			if(m_pos<m_pixels.Length()){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calimage.monkey<54>");
				Array<int > t_col=bb_calimage_IntToRGBA((m_pixels.At(m_pos)).ToInt());
				DBG_LOCAL(t_col,"col")
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calimage.monkey<55>");
				m_tex->p_SetPixel(m_posx,m_posy,t_col.At(1),t_col.At(2),t_col.At(3),t_col.At(0));
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calimage.monkey<57>");
				m_posx=m_posx+1;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calimage.monkey<58>");
				if(m_posx>=m_w){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calimage.monkey<59>");
					m_posx=0;
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calimage.monkey<60>");
					m_posy=m_posy+1;
					DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calimage.monkey<61>");
					bbPrint(String(L"posy: ",6)+String(m_posy));
				}
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calimage.monkey<63>");
				m_pos=m_pos+1;
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calimage.monkey<66>");
				bbPrint(String(L"Finished Loading Image",22));
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calimage.monkey<67>");
				p_MakeTexture();
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calimage.monkey<68>");
				m_finished=true;
				DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calimage.monkey<69>");
				break;
			}
		}
	}
}
c_CalImage* c_CalImage::m_new(){
	DBG_ENTER("CalImage.new")
	c_CalImage *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calimage.monkey<15>");
	m_w=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calimage.monkey<16>");
	m_h=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calimage.monkey<17>");
	m_pos=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calimage.monkey<18>");
	gc_assign(m_pixels,Array<String >(0));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calimage.monkey<19>");
	m_finished=false;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calimage.monkey<20>");
	m_posx=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calimage.monkey<21>");
	m_posy=0;
	return this;
}
c_CalImage* c_CalImage::m_new2(int t_ww,int t_hh,Array<String > t_pix){
	DBG_ENTER("CalImage.new")
	c_CalImage *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_ww,"ww")
	DBG_LOCAL(t_hh,"hh")
	DBG_LOCAL(t_pix,"pix")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calimage.monkey<25>");
	m_w=t_ww;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calimage.monkey<26>");
	m_h=t_hh;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calimage.monkey<27>");
	gc_assign(m_pixels,t_pix);
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calimage.monkey<28>");
	m_finished=false;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calimage.monkey<29>");
	m_posx=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calimage.monkey<30>");
	m_posy=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calimage.monkey<31>");
	bbPrint(String(L"New CalImage W: ",16)+String(m_w)+String(L" H: ",4)+String(m_h)+String(L" pixels: ",9)+String(m_pixels.Length()));
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calimage.monkey<32>");
	gc_assign(m_tex,c_TPixmap::m_CreatePixmap(m_w,m_h,4));
	return this;
}
void c_CalImage::mark(){
	Object::mark();
	gc_mark_q(m_pixels);
	gc_mark_q(m_tex);
	gc_mark_q(m_texture);
}
String c_CalImage::debug(){
	String t="(CalImage)\n";
	t+=dbg_decl("w",&m_w);
	t+=dbg_decl("h",&m_h);
	t+=dbg_decl("pixels",&m_pixels);
	t+=dbg_decl("tex",&m_tex);
	t+=dbg_decl("texture",&m_texture);
	t+=dbg_decl("pos",&m_pos);
	t+=dbg_decl("posx",&m_posx);
	t+=dbg_decl("posy",&m_posy);
	t+=dbg_decl("finished",&m_finished);
	return t;
}
Array<int > bb_calimage_IntToRGBA(int t_Value){
	DBG_ENTER("IntToRGBA")
	DBG_LOCAL(t_Value,"Value")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calimage.monkey<83>");
	Array<int > t_rgba=Array<int >(4);
	DBG_LOCAL(t_rgba,"rgba")
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calimage.monkey<84>");
	t_rgba.At(0)=t_Value>>24&255;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calimage.monkey<85>");
	t_rgba.At(1)=t_Value>>16&255;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calimage.monkey<86>");
	t_rgba.At(2)=t_Value>>8&255;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calimage.monkey<87>");
	t_rgba.At(3)=t_Value&255;
	DBG_INFO("C:/MonkeyXPro77f/modules/cal3d/calimage.monkey<88>");
	return t_rgba;
}
int bb_functions_EntityTexture(c_TEntity* t_ent,c_TTexture* t_tex,int t_frame,int t_index){
	DBG_ENTER("EntityTexture")
	DBG_LOCAL(t_ent,"ent")
	DBG_LOCAL(t_tex,"tex")
	DBG_LOCAL(t_frame,"frame")
	DBG_LOCAL(t_index,"index")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/functions.monkey<690>");
	dynamic_cast<c_TMesh*>(t_ent)->p_EntityTexture(t_tex,t_frame,t_index);
	return 0;
}
c_IAsyncEventSource* bb_asyncevent__current;
int bb_asyncevent_UpdateAsyncEvents(){
	DBG_ENTER("UpdateAsyncEvents")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/asyncevent.monkey<24>");
	if((bb_asyncevent__current)!=0){
		DBG_BLOCK();
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/asyncevent.monkey<25>");
	int t_i=0;
	DBG_LOCAL(t_i,"i")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/asyncevent.monkey<26>");
	while(t_i<bb_asyncevent__sources->p_Length2()){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/asyncevent.monkey<27>");
		gc_assign(bb_asyncevent__current,bb_asyncevent__sources->p_Get(t_i));
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/asyncevent.monkey<28>");
		bb_asyncevent__current->p_UpdateAsyncEvents();
		DBG_INFO("C:/MonkeyXPro77f/modules/brl/asyncevent.monkey<29>");
		if((bb_asyncevent__current)!=0){
			DBG_BLOCK();
			t_i+=1;
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/asyncevent.monkey<31>");
	bb_asyncevent__current=0;
	return 0;
}
int bb_input_KeyDown(int t_key){
	DBG_ENTER("KeyDown")
	DBG_LOCAL(t_key,"key")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/input.monkey<40>");
	int t_=((bb_input_device->p_KeyDown(t_key))?1:0);
	return t_;
}
int bb_input_TouchDown(int t_index){
	DBG_ENTER("TouchDown")
	DBG_LOCAL(t_index,"index")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/input.monkey<84>");
	int t_=((bb_input_device->p_KeyDown(384+t_index))?1:0);
	return t_;
}
Float bb_input_TouchX(int t_index){
	DBG_ENTER("TouchX")
	DBG_LOCAL(t_index,"index")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/input.monkey<76>");
	Float t_=bb_input_device->p_TouchX(t_index);
	return t_;
}
Float bb_input_TouchY(int t_index){
	DBG_ENTER("TouchY")
	DBG_LOCAL(t_index,"index")
	DBG_INFO("C:/MonkeyXPro77f/modules/mojo/input.monkey<80>");
	Float t_=bb_input_device->p_TouchY(t_index);
	return t_;
}
c_EffectState::c_EffectState(){
	m_use_full_bright=0;
	m_use_vertex_colors=0;
	m_use_flatshade=0;
	m_use_fog=1;
	Float t_[]={FLOAT(1.0),FLOAT(1.0),FLOAT(1.0),FLOAT(1.0)};
	m_ambient=Array<Float >(t_,4);
	Float t_2[]={FLOAT(1.0),FLOAT(1.0),FLOAT(1.0),FLOAT(1.0)};
	m_diffuse=Array<Float >(t_2,4);
	Float t_3[]={FLOAT(1.0),FLOAT(1.0),FLOAT(1.0),FLOAT(1.0)};
	m_specular=Array<Float >(t_3,4);
	Float t_4[]={FLOAT(100.0)};
	m_shininess=Array<Float >(t_4,1);
	m_use_depth_test=0;
	m_use_depth_write=0;
	m_use_backface_culling=0;
	m_use_alpha_test=0;
	m_use_perpixellighting=0;
	m_red=FLOAT(.0);
	m_green=FLOAT(.0);
	m_blue=FLOAT(.0);
	m_alpha=FLOAT(.0);
	m_shine=FLOAT(.0);
	m_blend=0;
	m_fx=0;
	m_num_tex=0;
	m_tex=Array<c_TTexture* >();
}
c_EffectState* c_EffectState::m_new(){
	DBG_ENTER("EffectState.new")
	c_EffectState *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<542>");
	return this;
}
void c_EffectState::p_SetNull(){
	DBG_ENTER("EffectState.SetNull")
	c_EffectState *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<595>");
	m_use_full_bright=-1;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<596>");
	m_use_vertex_colors=-1;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<597>");
	m_use_flatshade=-1;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<598>");
	m_use_fog=-1;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<599>");
	Float t_[]={FLOAT(-1.0),FLOAT(-1.0),FLOAT(-1.0),FLOAT(1.0)};
	gc_assign(m_ambient,Array<Float >(t_,4));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<603>");
	Float t_2[]={FLOAT(-1.0),FLOAT(-1.0),FLOAT(-1.0),FLOAT(1.0)};
	gc_assign(m_diffuse,Array<Float >(t_2,4));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<604>");
	Float t_3[]={FLOAT(-1.0),FLOAT(-1.0),FLOAT(-1.0),FLOAT(1.0)};
	gc_assign(m_specular,Array<Float >(t_3,4));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<605>");
	Float t_4[]={FLOAT(-1.0)};
	gc_assign(m_shininess,Array<Float >(t_4,1));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<607>");
	m_use_depth_test=-1;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<608>");
	m_use_depth_write=-1;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<609>");
	m_use_backface_culling=-1;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<610>");
	m_use_alpha_test=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<611>");
	m_use_perpixellighting=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<612>");
	m_red=FLOAT(-1.0);
	m_green=FLOAT(-1.0);
	m_blue=FLOAT(-1.0);
	m_alpha=FLOAT(-1.0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<613>");
	m_shine=FLOAT(-1.0);
	m_blend=99999;
	m_fx=99999;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<615>");
	m_num_tex=-1;
}
void c_EffectState::p_UpdateEffect(c_TSurface* t_surf,c_TEntity* t_ent,c_TCamera* t_cam){
	DBG_ENTER("EffectState.UpdateEffect")
	c_EffectState *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_surf,"surf")
	DBG_LOCAL(t_ent,"ent")
	DBG_LOCAL(t_cam,"cam")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<622>");
	Float t_ambient_red=FLOAT(.0);
	Float t_ambient_green=FLOAT(.0);
	Float t_ambient_blue=FLOAT(.0);
	DBG_LOCAL(t_ambient_red,"ambient_red")
	DBG_LOCAL(t_ambient_green,"ambient_green")
	DBG_LOCAL(t_ambient_blue,"ambient_blue")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<625>");
	m_red=t_ent->m_brush->m_red;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<626>");
	m_green=t_ent->m_brush->m_green;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<627>");
	m_blue=t_ent->m_brush->m_blue;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<628>");
	m_alpha=t_ent->m_brush->m_alpha;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<629>");
	m_shine=t_ent->m_brush->m_shine;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<630>");
	m_blend=t_ent->m_brush->m_blend;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<631>");
	m_fx=t_ent->m_brush->m_fx;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<632>");
	m_num_tex=t_ent->m_brush->m_no_texs;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<633>");
	gc_assign(m_tex,t_ent->m_brush->m_tex);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<636>");
	if((t_surf->m_brush)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<638>");
		Float t_shine2=FLOAT(0.0);
		DBG_LOCAL(t_shine2,"shine2")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<640>");
		m_red=m_red*t_surf->m_brush->m_red;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<641>");
		m_green=m_green*t_surf->m_brush->m_green;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<642>");
		m_blue=m_blue*t_surf->m_brush->m_blue;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<643>");
		m_alpha=m_alpha*t_surf->m_brush->m_alpha;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<644>");
		t_shine2=t_surf->m_brush->m_shine;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<645>");
		if(m_shine==FLOAT(0.0)){
			DBG_BLOCK();
			m_shine=t_shine2;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<646>");
		if(m_shine!=FLOAT(0.0) && t_shine2!=FLOAT(0.0)){
			DBG_BLOCK();
			m_shine=m_shine*t_shine2;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<647>");
		if(m_blend==0){
			DBG_BLOCK();
			m_blend=t_surf->m_brush->m_blend;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<648>");
		m_fx=m_fx|t_surf->m_brush->m_fx;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<649>");
		if(m_num_tex<t_surf->m_brush->m_no_texs){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<650>");
			m_num_tex=t_surf->m_brush->m_no_texs;
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<651>");
			gc_assign(m_tex,t_surf->m_brush->m_tex);
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<656>");
	m_alpha=m_alpha-t_ent->m_fade_alpha;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<658>");
	m_use_depth_test=1;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<659>");
	m_use_depth_write=1;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<662>");
	int t_enable_blend=0;
	DBG_LOCAL(t_enable_blend,"enable_blend")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<663>");
	if(t_ent->m_using_alpha==true){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<665>");
		if(t_ent->m_brush->m_alpha<FLOAT(1.0)){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<667>");
			t_enable_blend=1;
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<669>");
			m_use_depth_write=0;
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<670>");
			if(t_surf->m_alpha_enable==true){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<672>");
				t_enable_blend=1;
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<674>");
				m_use_depth_write=0;
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<677>");
				t_enable_blend=0;
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<678>");
				m_use_depth_test=1;
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<679>");
				m_use_depth_write=1;
			}
		}
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<683>");
		t_enable_blend=0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<688>");
	if(t_enable_blend==0){
		DBG_BLOCK();
		m_blend=-1;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<690>");
	m_use_vertex_colors=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<691>");
	m_use_flatshade=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<692>");
	m_use_fog=((t_cam->m_fog_mode>0)?1:0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<695>");
	if((m_fx&1)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<696>");
		t_ambient_red=FLOAT(0.0);
		t_ambient_green=FLOAT(0.0);
		t_ambient_blue=FLOAT(0.0);
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<697>");
		m_use_full_bright=1;
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<699>");
		t_ambient_red=c_TLight::m_ambient_red;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<700>");
		t_ambient_green=c_TLight::m_ambient_green;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<701>");
		t_ambient_blue=c_TLight::m_ambient_blue;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<702>");
		m_use_full_bright=0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<707>");
	if((m_fx&2)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<708>");
		m_use_vertex_colors=1;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<709>");
		m_red=FLOAT(1.0);
		m_green=FLOAT(1.0);
		m_blue=FLOAT(1.0);
		m_alpha=FLOAT(1.0);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<713>");
	if((m_fx&4)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<714>");
		m_use_flatshade=1;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<718>");
	if((m_fx&8)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<719>");
		m_use_fog=0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<723>");
	if((m_fx&16)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<724>");
		m_use_backface_culling=0;
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<727>");
		m_use_backface_culling=1;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<734>");
	if((m_fx&64)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<736>");
		m_use_depth_test=0;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<737>");
		m_use_depth_write=0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<741>");
	m_use_alpha_test=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<743>");
	int t_tex_alphatest=0;
	DBG_LOCAL(t_tex_alphatest,"tex_alphatest")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<744>");
	if(m_num_tex>0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<745>");
		for(int t_i=0;t_i<=m_num_tex-1;t_i=t_i+1){
			DBG_BLOCK();
			DBG_LOCAL(t_i,"i")
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<746>");
			if((m_tex.At(t_i))!=0){
				DBG_BLOCK();
				t_tex_alphatest|=m_tex.At(t_i)->m_flags&4;
			}
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<750>");
	if((m_fx&128)>0 || t_tex_alphatest>0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<751>");
		m_use_alpha_test=1;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<752>");
		m_use_depth_test=1;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<753>");
		m_use_depth_write=1;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<756>");
	if((m_fx&256)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<757>");
		m_use_perpixellighting=1;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<762>");
	Float t_[]={t_ambient_red,t_ambient_green,t_ambient_blue,FLOAT(0.0)};
	gc_assign(m_ambient,Array<Float >(t_,4));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<765>");
	Float t_2[]={m_red,m_green,m_blue,m_alpha};
	gc_assign(m_diffuse,Array<Float >(t_2,4));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<766>");
	Float t_3[]={m_shine,m_shine,m_shine,FLOAT(1.0)};
	gc_assign(m_specular,Array<Float >(t_3,4));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<767>");
	Float t_4[]={FLOAT(100.0)};
	gc_assign(m_shininess,Array<Float >(t_4,1));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<769>");
	if((t_cam->m_draw2D)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<772>");
		if((m_fx&64)==0){
			DBG_BLOCK();
			m_use_depth_test=0;
			m_use_depth_write=0;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<774>");
		m_use_fog=0;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<776>");
		m_use_full_bright=1;
	}
}
void c_EffectState::p_Overwrite2(c_EffectState* t_e){
	DBG_ENTER("EffectState.Overwrite")
	c_EffectState *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_e,"e")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<571>");
	m_use_full_bright=t_e->m_use_full_bright;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<572>");
	m_use_vertex_colors=t_e->m_use_vertex_colors;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<573>");
	m_use_flatshade=t_e->m_use_flatshade;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<574>");
	m_use_fog=t_e->m_use_fog;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<575>");
	Float t_[]={t_e->m_ambient.At(0),t_e->m_ambient.At(1),t_e->m_ambient.At(2),t_e->m_ambient.At(3)};
	gc_assign(m_ambient,Array<Float >(t_,4));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<579>");
	Float t_2[]={t_e->m_diffuse.At(0),t_e->m_diffuse.At(1),t_e->m_diffuse.At(2),t_e->m_diffuse.At(3)};
	gc_assign(m_diffuse,Array<Float >(t_2,4));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<580>");
	Float t_3[]={t_e->m_specular.At(0),t_e->m_specular.At(1),t_e->m_specular.At(2),t_e->m_specular.At(3)};
	gc_assign(m_specular,Array<Float >(t_3,4));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<581>");
	Float t_4[]={t_e->m_shininess.At(0)};
	gc_assign(m_shininess,Array<Float >(t_4,1));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<583>");
	m_use_depth_test=t_e->m_use_depth_test;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<584>");
	m_use_depth_write=t_e->m_use_depth_write;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<585>");
	m_use_backface_culling=t_e->m_use_backface_culling;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<586>");
	m_red=t_e->m_red;
	m_green=t_e->m_green;
	m_blue=t_e->m_blue;
	m_alpha=t_e->m_alpha;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<587>");
	m_shine=t_e->m_shine;
	m_blend=t_e->m_blend;
	m_fx=t_e->m_fx;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<588>");
	m_use_alpha_test=t_e->m_use_alpha_test;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<589>");
	m_use_perpixellighting=t_e->m_use_perpixellighting;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<591>");
	m_num_tex=t_e->m_num_tex;
}
void c_EffectState::mark(){
	Object::mark();
	gc_mark_q(m_ambient);
	gc_mark_q(m_diffuse);
	gc_mark_q(m_specular);
	gc_mark_q(m_shininess);
	gc_mark_q(m_tex);
}
String c_EffectState::debug(){
	String t="(EffectState)\n";
	t+=dbg_decl("use_full_bright",&m_use_full_bright);
	t+=dbg_decl("use_vertex_colors",&m_use_vertex_colors);
	t+=dbg_decl("use_flatshade",&m_use_flatshade);
	t+=dbg_decl("use_fog",&m_use_fog);
	t+=dbg_decl("use_depth_test",&m_use_depth_test);
	t+=dbg_decl("use_depth_write",&m_use_depth_write);
	t+=dbg_decl("use_backface_culling",&m_use_backface_culling);
	t+=dbg_decl("use_alpha_test",&m_use_alpha_test);
	t+=dbg_decl("use_perpixellighting",&m_use_perpixellighting);
	t+=dbg_decl("ambient",&m_ambient);
	t+=dbg_decl("diffuse",&m_diffuse);
	t+=dbg_decl("specular",&m_specular);
	t+=dbg_decl("shininess",&m_shininess);
	t+=dbg_decl("shine",&m_shine);
	t+=dbg_decl("red",&m_red);
	t+=dbg_decl("green",&m_green);
	t+=dbg_decl("blue",&m_blue);
	t+=dbg_decl("alpha",&m_alpha);
	t+=dbg_decl("blend",&m_blend);
	t+=dbg_decl("fx",&m_fx);
	t+=dbg_decl("num_tex",&m_num_tex);
	t+=dbg_decl("tex",&m_tex);
	return t;
}
c_SurfaceAlphaList::c_SurfaceAlphaList(){
}
c_SurfaceAlphaList* c_SurfaceAlphaList::m_new(){
	DBG_ENTER("SurfaceAlphaList.new")
	c_SurfaceAlphaList *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/trender.monkey<803>");
	c_List2::m_new();
	return this;
}
void c_SurfaceAlphaList::mark(){
	c_List2::mark();
}
String c_SurfaceAlphaList::debug(){
	String t="(SurfaceAlphaList)\n";
	t=c_List2::debug()+t;
	return t;
}
c_FloatBuffer::c_FloatBuffer(){
	m_buf=0;
}
void c_FloatBuffer::mark(){
	Object::mark();
	gc_mark_q(m_buf);
}
String c_FloatBuffer::debug(){
	String t="(FloatBuffer)\n";
	t+=dbg_decl("buf",&m_buf);
	return t;
}
c_TVertexAnim::c_TVertexAnim(){
}
void c_TVertexAnim::mark(){
	c_FloatBuffer::mark();
}
String c_TVertexAnim::debug(){
	String t="(TVertexAnim)\n";
	t=c_FloatBuffer::debug()+t;
	return t;
}
c_TPixmapGL::c_TPixmapGL(){
	m_pixels=0;
	m_format=0;
	m_pitch=0;
}
c_TPixmapGL* c_TPixmapGL::m_new(){
	DBG_ENTER("TPixmapGL.new")
	c_TPixmapGL *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<58>");
	c_TPixmap::m_new();
	return this;
}
int c_TPixmapGL::m_Init(){
	DBG_ENTER("TPixmapGL.Init")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<68>");
	if(!((c_TPixmap::m_manager)!=0)){
		DBG_BLOCK();
		gc_assign(c_TPixmap::m_manager,((new c_TPixmapGL)->m_new()));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<69>");
	if(!((c_TPixmap::m_preloader)!=0)){
		DBG_BLOCK();
		gc_assign(c_TPixmap::m_preloader,(new c_TPixmapPreloader)->m_new((new c_PreloadGL)->m_new()));
	}
	return 0;
}
c_TPixmap* c_TPixmapGL::p_CreatePixmap(int t_w,int t_h,int t_format){
	DBG_ENTER("TPixmapGL.CreatePixmap")
	c_TPixmapGL *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_w,"w")
	DBG_LOCAL(t_h,"h")
	DBG_LOCAL(t_format,"format")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<94>");
	c_TPixmapGL* t_p=(new c_TPixmapGL)->m_new();
	DBG_LOCAL(t_p,"p")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<96>");
	gc_assign(t_p->m_pixels,bb_monkeybuffer_CreateDataBuffer(t_w*t_h*4));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<97>");
	t_p->m_width=t_w;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<98>");
	t_p->m_height=t_h;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<99>");
	t_p->m_format=t_format;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<100>");
	t_p->m_pitch=t_w;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<102>");
	for(int t_y=0;t_y<=t_h-1;t_y=t_y+1){
		DBG_BLOCK();
		DBG_LOCAL(t_y,"y")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<103>");
		for(int t_x=0;t_x<=t_w-1;t_x=t_x+1){
			DBG_BLOCK();
			DBG_LOCAL(t_x,"x")
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<105>");
			t_p->m_pixels->PokeInt((t_x<<2)+t_y*(t_w<<2),-1);
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<110>");
	c_TPixmap* t_=(t_p);
	return t_;
}
int c_TPixmapGL::p_GetPixel(int t_x,int t_y){
	DBG_ENTER("TPixmapGL.GetPixel")
	c_TPixmapGL *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_x,"x")
	DBG_LOCAL(t_y,"y")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<219>");
	if(t_x<0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<220>");
		t_x=0;
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<221>");
		if(t_x>m_width-1){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<222>");
			t_x=m_width-1;
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<224>");
	if(t_y<0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<225>");
		t_y=0;
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<226>");
		if(t_y>m_height-1){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<227>");
			t_y=m_height-1;
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<235>");
	int t_=m_pixels->PeekInt((t_x<<2)+t_y*(m_width<<2));
	return t_;
}
c_TPixmap* c_TPixmapGL::p_ResizePixmap(int t_neww,int t_newh){
	DBG_ENTER("TPixmapGL.ResizePixmap")
	c_TPixmapGL *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_neww,"neww")
	DBG_LOCAL(t_newh,"newh")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<118>");
	int t_enlarge=0;
	int t_r=0;
	int t_g=0;
	int t_b=0;
	int t_a=0;
	DBG_LOCAL(t_enlarge,"enlarge")
	DBG_LOCAL(t_r,"r")
	DBG_LOCAL(t_g,"g")
	DBG_LOCAL(t_b,"b")
	DBG_LOCAL(t_a,"a")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<120>");
	if(m_width==0 || m_height==0 || t_neww==0 || t_newh==0){
		DBG_BLOCK();
		c_TPixmap* t_=p_CreatePixmap(0,0,4);
		return t_;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<122>");
	Float t_ratiow=Float(m_width)/Float(t_neww);
	DBG_LOCAL(t_ratiow,"ratiow")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<123>");
	Float t_ratioh=Float(m_height)/Float(t_newh);
	DBG_LOCAL(t_ratioh,"ratioh")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<126>");
	c_TPixmapGL* t_newpix=dynamic_cast<c_TPixmapGL*>(p_CreatePixmap(t_neww,t_newh,4));
	DBG_LOCAL(t_newpix,"newpix")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<127>");
	if(t_neww<1 || t_newh<1){
		DBG_BLOCK();
		c_TPixmap* t_2=(t_newpix);
		return t_2;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<129>");
	Array<int > t_rgb=Array<int >(5);
	DBG_LOCAL(t_rgb,"rgb")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<130>");
	for(int t_iy=0;t_iy<t_newh;t_iy=t_iy+1){
		DBG_BLOCK();
		DBG_LOCAL(t_iy,"iy")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<131>");
		for(int t_ix=0;t_ix<t_neww;t_ix=t_ix+1){
			DBG_BLOCK();
			DBG_LOCAL(t_ix,"ix")
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<133>");
			Float t_fx=Float(t_ix)*t_ratiow;
			DBG_LOCAL(t_fx,"fx")
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<134>");
			Float t_fy=Float(t_iy)*t_ratioh;
			DBG_LOCAL(t_fy,"fy")
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<136>");
			int t_x=int(t_fx);
			DBG_LOCAL(t_x,"x")
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<137>");
			int t_y=int(t_fy);
			DBG_LOCAL(t_y,"y")
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<140>");
			t_rgb.At(0)=p_GetPixel(t_x,t_y);
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<141>");
			t_rgb.At(1)=p_GetPixel(t_x+1,t_y);
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<142>");
			t_rgb.At(2)=p_GetPixel(t_x,t_y+1);
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<143>");
			t_rgb.At(3)=p_GetPixel(t_x+1,t_y+1);
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<146>");
			int t_dx=int((t_fx-Float(t_x))*FLOAT(16.0));
			DBG_LOCAL(t_dx,"dx")
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<147>");
			int t_dy=int((t_fy-Float(t_y))*FLOAT(16.0));
			DBG_LOCAL(t_dy,"dy")
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<150>");
			int t_y1=(t_rgb.At(0)&255)+t_dx*((t_rgb.At(1)&255)-(t_rgb.At(0)&255))/16;
			DBG_LOCAL(t_y1,"y1")
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<151>");
			int t_y2=(t_rgb.At(2)&255)+t_dx*((t_rgb.At(3)&255)-(t_rgb.At(2)&255))/16;
			DBG_LOCAL(t_y2,"y2")
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<152>");
			t_r=t_y1+t_dy*(t_y2-t_y1)/16;
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<154>");
			t_y1=((t_rgb.At(0)&65280)>>8)+t_dx*(((t_rgb.At(1)&65280)>>8)-((t_rgb.At(0)&65280)>>8))/16;
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<155>");
			t_y2=((t_rgb.At(2)&65280)>>8)+t_dx*(((t_rgb.At(3)&65280)>>8)-((t_rgb.At(2)&65280)>>8))/16;
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<156>");
			t_g=t_y1+t_dy*(t_y2-t_y1)/16;
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<158>");
			t_y1=((t_rgb.At(0)&16711680)>>16)+t_dx*(((t_rgb.At(1)&16711680)>>16)-((t_rgb.At(0)&16711680)>>16))/16;
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<159>");
			t_y2=((t_rgb.At(2)&16711680)>>16)+t_dx*(((t_rgb.At(3)&16711680)>>16)-((t_rgb.At(2)&16711680)>>16))/16;
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<160>");
			t_b=t_y1+t_dy*(t_y2-t_y1)/16;
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<162>");
			t_y1=((t_rgb.At(0)&-16777216)>>24)+t_dx*(((t_rgb.At(1)&-16777216)>>24)-((t_rgb.At(0)&-16777216)>>24))/16;
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<163>");
			t_y2=((t_rgb.At(2)&-16777216)>>24)+t_dx*(((t_rgb.At(3)&-16777216)>>24)-((t_rgb.At(2)&-16777216)>>24))/16;
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<164>");
			t_a=t_y1+t_dy*(t_y2-t_y1)/16;
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<166>");
			t_g=t_g<<8;
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<167>");
			t_b=t_b<<16;
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<168>");
			t_a=t_a<<24;
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<172>");
			t_newpix->m_pixels->PokeInt((t_ix<<2)+t_iy*(t_neww<<2),t_r|t_g|t_b|t_a);
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<177>");
	c_TPixmap* t_3=(t_newpix);
	return t_3;
}
c_TPixmap* c_TPixmapGL::p_ResizePixmapNoSmooth(int t_neww,int t_newh){
	DBG_ENTER("TPixmapGL.ResizePixmapNoSmooth")
	c_TPixmapGL *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_neww,"neww")
	DBG_LOCAL(t_newh,"newh")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<185>");
	int t_enlarge=0;
	DBG_LOCAL(t_enlarge,"enlarge")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<187>");
	Float t_ratiow=Float(m_width)/Float(t_neww);
	DBG_LOCAL(t_ratiow,"ratiow")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<188>");
	Float t_ratioh=Float(m_height)/Float(t_newh);
	DBG_LOCAL(t_ratioh,"ratioh")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<190>");
	c_TPixmapGL* t_newpix=dynamic_cast<c_TPixmapGL*>(p_CreatePixmap(t_neww,t_newh,4));
	DBG_LOCAL(t_newpix,"newpix")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<191>");
	if(t_neww<1 || t_newh<1){
		DBG_BLOCK();
		c_TPixmap* t_=(t_newpix);
		return t_;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<193>");
	Array<int > t_rgb=Array<int >(5);
	Float t_yi=FLOAT(0.0);
	int t_xx=0;
	int t_yy=0;
	int t_red=0;
	int t_green=0;
	int t_blue=0;
	int t_alpha=0;
	DBG_LOCAL(t_rgb,"rgb")
	DBG_LOCAL(t_yi,"yi")
	DBG_LOCAL(t_xx,"xx")
	DBG_LOCAL(t_yy,"yy")
	DBG_LOCAL(t_red,"red")
	DBG_LOCAL(t_green,"green")
	DBG_LOCAL(t_blue,"blue")
	DBG_LOCAL(t_alpha,"alpha")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<195>");
	for(int t_y=0;t_y<=t_newh-1;t_y=t_y+1){
		DBG_BLOCK();
		DBG_LOCAL(t_y,"y")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<196>");
		Float t_xi=FLOAT(0.0);
		DBG_LOCAL(t_xi,"xi")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<197>");
		for(int t_x=0;t_x<=t_neww-1;t_x=t_x+1){
			DBG_BLOCK();
			DBG_LOCAL(t_x,"x")
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<199>");
			t_xx=int(t_xi);
			t_yy=int(t_yi);
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<202>");
			t_rgb.At(0)=p_GetPixel(t_xx,t_yy);
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<204>");
			t_newpix->m_pixels->PokeInt((t_x<<2)+t_y*(t_neww<<2),t_rgb.At(0));
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<206>");
			t_xi=t_xi+t_ratiow;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<208>");
		t_yi=t_yi+t_ratioh;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<211>");
	c_TPixmap* t_2=(t_newpix);
	return t_2;
}
c_TPixmap* c_TPixmapGL::p_LoadPixmap(String t_f){
	DBG_ENTER("TPixmapGL.LoadPixmap")
	c_TPixmapGL *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_f,"f")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<76>");
	c_TPixmapGL* t_p=(new c_TPixmapGL)->m_new();
	DBG_LOCAL(t_p,"p")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<79>");
	c_TPixmap::m_preloader->p_GetPixmapPreLoad((t_p),t_f);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<81>");
	t_p->m_format=4;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<83>");
	if((t_p->m_height)!=0){
		DBG_BLOCK();
		t_p->m_pitch=int(Float(bb_monkeybuffer_GetBufferLength(t_p->m_pixels))/FLOAT(4.0)/Float(t_p->m_height));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<85>");
	if(t_p->m_width==0){
		DBG_BLOCK();
		bb_tutility_Dprint(String(L"Image Not Found: ",17)+t_f,String(),String(),String(),String(),String());
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<87>");
	c_TPixmap* t_=(t_p);
	return t_;
}
void c_TPixmapGL::p_SetPixel(int t_x,int t_y,int t_r,int t_g,int t_b,int t_a){
	DBG_ENTER("TPixmapGL.SetPixel")
	c_TPixmapGL *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_x,"x")
	DBG_LOCAL(t_y,"y")
	DBG_LOCAL(t_r,"r")
	DBG_LOCAL(t_g,"g")
	DBG_LOCAL(t_b,"b")
	DBG_LOCAL(t_a,"a")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<242>");
	if(t_x<0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<243>");
		t_x=0;
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<244>");
		if(t_x>m_width-1){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<245>");
			t_x=m_width-1;
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<247>");
	if(t_y<0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<248>");
		t_y=0;
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<249>");
		if(t_y>m_height-1){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<250>");
			t_y=m_height-1;
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<259>");
	m_pixels->PokeInt((t_x<<2)+t_y*(m_width<<2),t_a<<24|t_b<<16|t_g<<8|t_r);
}
void c_TPixmapGL::p_MaskPixmap(int t_r,int t_g,int t_b){
	DBG_ENTER("TPixmapGL.MaskPixmap")
	c_TPixmapGL *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_r,"r")
	DBG_LOCAL(t_g,"g")
	DBG_LOCAL(t_b,"b")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<265>");
	int t_maskcolor=(t_r|t_g<<8|t_b<<16)&16777215;
	DBG_LOCAL(t_maskcolor,"maskcolor")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<267>");
	for(int t_y=0;t_y<=m_height-1;t_y=t_y+1){
		DBG_BLOCK();
		DBG_LOCAL(t_y,"y")
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<268>");
		for(int t_x=0;t_x<=m_width-1;t_x=t_x+1){
			DBG_BLOCK();
			DBG_LOCAL(t_x,"x")
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<271>");
			int t_pix=p_GetPixel(t_x,t_y)&16777215;
			DBG_LOCAL(t_pix,"pix")
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<273>");
			if(t_maskcolor==t_pix){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<275>");
				m_pixels->PokeInt(t_x*4+t_y*m_pitch*4,t_pix&16777215);
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<278>");
				m_pixels->PokeInt(t_x*4+t_y*m_pitch*4,t_pix|-16777216);
			}
		}
	}
}
void c_TPixmapGL::p_FreePixmap(){
	DBG_ENTER("TPixmapGL.FreePixmap")
	c_TPixmapGL *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<317>");
	m_pixels->Discard();
}
void c_TPixmapGL::mark(){
	c_TPixmap::mark();
	gc_mark_q(m_pixels);
}
String c_TPixmapGL::debug(){
	String t="(TPixmapGL)\n";
	t=c_TPixmap::debug()+t;
	t+=dbg_decl("pixels",&m_pixels);
	t+=dbg_decl("format",&m_format);
	t+=dbg_decl("pitch",&m_pitch);
	return t;
}
c_PreloadGL::c_PreloadGL(){
	m_p_map=(new c_ArrayIntMap)->m_new();
}
c_PreloadGL* c_PreloadGL::m_new(){
	DBG_ENTER("PreloadGL.new")
	c_PreloadGL *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<331>");
	return this;
}
bool c_PreloadGL::p_IsLoaded(int t_file_id){
	DBG_ENTER("PreloadGL.IsLoaded")
	c_PreloadGL *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_file_id,"file_id")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<337>");
	c_PreloadData* t_f=m_p_map->p_Get(t_file_id);
	DBG_LOCAL(t_f,"f")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<338>");
	if((t_f)!=0){
		DBG_BLOCK();
		return t_f->m_loaded;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<340>");
	return false;
}
void c_PreloadGL::p_PreLoadData(String t_f,int t_id){
	DBG_ENTER("PreloadGL.PreLoadData")
	c_PreloadGL *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_f,"f")
	DBG_LOCAL(t_id,"id")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<349>");
	if(t_id<1){
		DBG_BLOCK();
		return;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<350>");
	Array<int > t_info=Array<int >(2);
	DBG_LOCAL(t_info,"info")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<354>");
	t_f=bb_data_FixDataPath(t_f);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<357>");
	c_PreloadData* t_d=(new c_PreloadData)->m_new();
	DBG_LOCAL(t_d,"d")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<358>");
	t_d->m_id=t_id;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<359>");
	gc_assign(t_d->m_data,bb_gles11_LoadImageData(t_f,t_info));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<360>");
	t_d->m_w=t_info.At(0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<361>");
	t_d->m_h=t_info.At(1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<363>");
	t_d->m_loaded=true;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<364>");
	if(!((t_d->m_data)!=0)){
		DBG_BLOCK();
		t_d->m_w=0;
		t_d->m_h=0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<366>");
	m_p_map->p_Set7(t_id,t_d);
}
void c_PreloadGL::p_SetPixmapFromID(c_TPixmap* t_pixmap,int t_id,String t_f){
	DBG_ENTER("PreloadGL.SetPixmapFromID")
	c_PreloadGL *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_pixmap,"pixmap")
	DBG_LOCAL(t_id,"id")
	DBG_LOCAL(t_f,"f")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<372>");
	c_TPixmapGL* t_p=dynamic_cast<c_TPixmapGL*>(t_pixmap);
	DBG_LOCAL(t_p,"p")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<373>");
	if((t_p)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<375>");
		if(t_id>0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<376>");
			c_PreloadData* t_d=m_p_map->p_Get(t_id);
			DBG_LOCAL(t_d,"d")
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<378>");
			if((t_d)!=0){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<381>");
				gc_assign(t_p->m_pixels,t_d->m_data);
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<382>");
				t_p->m_width=t_d->m_w;
				DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<383>");
				t_p->m_height=t_d->m_h;
			}
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<391>");
			Array<int > t_info=Array<int >(2);
			DBG_LOCAL(t_info,"info")
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<394>");
			t_f=bb_data_FixDataPath(t_f);
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<397>");
			gc_assign(t_p->m_pixels,bb_gles11_LoadImageData(t_f,t_info));
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<398>");
			t_p->m_width=t_info.At(0);
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<399>");
			t_p->m_height=t_info.At(1);
			DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<401>");
			if(!((t_p->m_pixels)!=0)){
				DBG_BLOCK();
				t_p->m_width=0;
			}
		}
	}
}
void c_PreloadGL::mark(){
	Object::mark();
	gc_mark_q(m_p_map);
}
String c_PreloadGL::debug(){
	String t="(PreloadGL)\n";
	t+=dbg_decl("p_map",&m_p_map);
	return t;
}
c_TTexture* bb_functions_CreateTexture(int t_width,int t_height,int t_flags,int t_frames){
	DBG_ENTER("CreateTexture")
	DBG_LOCAL(t_width,"width")
	DBG_LOCAL(t_height,"height")
	DBG_LOCAL(t_flags,"flags")
	DBG_LOCAL(t_frames,"frames")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/functions.monkey<524>");
	c_TTexture* t_=c_TTexture::m_CreateTexture(t_width,t_height,t_flags,t_frames,0);
	return t_;
}
Array<Float > bb_mojographics_Transform2D(c_Matrix* t_mat,Float t_x,Float t_y,Float t_z){
	DBG_ENTER("Transform2D")
	DBG_LOCAL(t_mat,"mat")
	DBG_LOCAL(t_x,"x")
	DBG_LOCAL(t_y,"y")
	DBG_LOCAL(t_z,"z")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<494>");
	Array<Float > t_t2d=Array<Float >(3);
	DBG_LOCAL(t_t2d,"t2d")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<495>");
	t_t2d.At(0)=t_mat->m_grid.At(0).At(0)*t_x+t_mat->m_grid.At(1).At(0)*t_y+t_mat->m_grid.At(3).At(0);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<496>");
	t_t2d.At(1)=t_mat->m_grid.At(0).At(1)*t_x+t_mat->m_grid.At(1).At(1)*t_y+t_mat->m_grid.At(3).At(1);
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<497>");
	t_t2d.At(2)=t_z;
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/mojographics.monkey<498>");
	return t_t2d;
}
c_XMLError::c_XMLError(){
	m_error=false;
	m_message=String();
	m_line=0;
	m_column=0;
	m_offset=0;
}
c_XMLError* c_XMLError::m_new(){
	DBG_ENTER("XMLError.new")
	c_XMLError *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1781>");
	return this;
}
void c_XMLError::p_Reset(){
	DBG_ENTER("XMLError.Reset")
	c_XMLError *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1791>");
	m_error=false;
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1792>");
	m_message=String();
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1793>");
	m_line=-1;
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1794>");
	m_column=-1;
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1795>");
	m_offset=-1;
}
void c_XMLError::p_Set4(String t_message,int t_line,int t_column,int t_offset){
	DBG_ENTER("XMLError.Set")
	c_XMLError *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_message,"message")
	DBG_LOCAL(t_line,"line")
	DBG_LOCAL(t_column,"column")
	DBG_LOCAL(t_offset,"offset")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1800>");
	m_error=true;
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1801>");
	this->m_message=t_message;
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1802>");
	this->m_line=t_line;
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1803>");
	this->m_column=t_column;
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1804>");
	this->m_offset=t_offset;
}
String c_XMLError::p_ToString(){
	DBG_ENTER("XMLError.ToString")
	c_XMLError *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1809>");
	if(m_error==false){
		DBG_BLOCK();
		return String();
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1810>");
	c_XMLStringBuffer* t_buffer=(new c_XMLStringBuffer)->m_new(256);
	DBG_LOCAL(t_buffer,"buffer")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1811>");
	t_buffer->p_Add5(String(L"XMLError: ",10));
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1814>");
	if((m_message.Length())!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1815>");
		t_buffer->p_Add5(m_message);
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1817>");
		t_buffer->p_Add5(String(L"unknown error",13));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1821>");
	t_buffer->p_Add5(String(L" [line:",7));
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1822>");
	if(m_line>-1){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1823>");
		t_buffer->p_Add5(String(m_line));
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1825>");
		t_buffer->p_Add5(String(L"??",2));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1829>");
	t_buffer->p_Add5(String(L"  column:",9));
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1830>");
	if(m_column>-1){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1831>");
		t_buffer->p_Add5(String(m_column));
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1833>");
		t_buffer->p_Add5(String(L"??",2));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1837>");
	t_buffer->p_Add5(String(L"  offset:",9));
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1838>");
	if(m_offset>-1){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1839>");
		t_buffer->p_Add5(String(m_offset)+String(L"]",1));
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1841>");
		t_buffer->p_Add5(String(L"??]",3));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1845>");
	String t_=t_buffer->p_value();
	return t_;
}
void c_XMLError::mark(){
	Object::mark();
}
String c_XMLError::debug(){
	String t="(XMLError)\n";
	t+=dbg_decl("error",&m_error);
	t+=dbg_decl("message",&m_message);
	t+=dbg_decl("line",&m_line);
	t+=dbg_decl("column",&m_column);
	t+=dbg_decl("offset",&m_offset);
	return t;
}
c_XMLNode::c_XMLNode(){
	m_value=String();
	m_valid=false;
	m_text=false;
	m_name=String();
	m_doc=0;
	m_parent=0;
	m_lastChild=0;
	m_nextSibling=0;
	m_previousSibling=0;
	m_firstChild=0;
	m_children=(new c_List13)->m_new();
	m_path=String();
	m_pathList=0;
	m_pathListNode=0;
	m_line=0;
	m_column=0;
	m_offset=0;
	m_attributes=(new c_StringMap3)->m_new();
}
c_XMLNode* c_XMLNode::m_new(String t_name,bool t_valid){
	DBG_ENTER("XMLNode.new")
	c_XMLNode *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_name,"name")
	DBG_LOCAL(t_valid,"valid")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<631>");
	if((t_name.Length())!=0){
		DBG_BLOCK();
		this->m_name=t_name.ToLower();
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<632>");
	this->m_valid=t_valid;
	return this;
}
c_XMLNode* c_XMLNode::m_new2(){
	DBG_ENTER("XMLNode.new")
	c_XMLNode *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<605>");
	return this;
}
c_XMLNode* c_XMLNode::p_AddText(String t_data){
	DBG_ENTER("XMLNode.AddText")
	c_XMLNode *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<857>");
	if(m_valid==false || m_text){
		DBG_BLOCK();
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<860>");
	m_value=m_value+t_data;
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<863>");
	c_XMLNode* t_child=(new c_XMLNode)->m_new(m_name,true);
	DBG_LOCAL(t_child,"child")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<864>");
	t_child->m_text=true;
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<865>");
	gc_assign(t_child->m_doc,m_doc);
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<866>");
	gc_assign(t_child->m_parent,this);
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<867>");
	t_child->m_value=t_data;
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<870>");
	if((m_lastChild)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<873>");
		gc_assign(m_lastChild->m_nextSibling,t_child);
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<876>");
		gc_assign(t_child->m_previousSibling,m_lastChild);
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<879>");
		gc_assign(m_lastChild,t_child);
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<882>");
		gc_assign(m_firstChild,t_child);
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<883>");
		gc_assign(m_lastChild,t_child);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<887>");
	m_children->p_AddLast13(t_child);
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<889>");
	return t_child;
}
void c_XMLNode::p_SetAttribute(String t_id){
	DBG_ENTER("XMLNode.SetAttribute")
	c_XMLNode *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_id,"id")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1468>");
	if(m_valid==false){
		DBG_BLOCK();
		return;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1471>");
	t_id=t_id.ToLower();
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1474>");
	c_XMLAttribute* t_attribute=m_attributes->p_Get2(t_id);
	DBG_LOCAL(t_attribute,"attribute")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1475>");
	if(t_attribute==0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1477>");
		m_attributes->p_Insert4(t_id,(new c_XMLAttribute)->m_new(t_id,String()));
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1480>");
		t_attribute->m_value=String();
	}
}
void c_XMLNode::p_SetAttribute2(String t_id,bool t_value){
	DBG_ENTER("XMLNode.SetAttribute")
	c_XMLNode *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_id,"id")
	DBG_LOCAL(t_value,"value")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1487>");
	if(m_valid==false){
		DBG_BLOCK();
		return;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1490>");
	t_id=t_id.ToLower();
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1493>");
	c_XMLAttribute* t_attribute=m_attributes->p_Get2(t_id);
	DBG_LOCAL(t_attribute,"attribute")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1494>");
	if(t_attribute==0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1496>");
		m_attributes->p_Insert4(t_id,(new c_XMLAttribute)->m_new(t_id,String((t_value)?1:0)));
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1499>");
		t_attribute->m_value=String((t_value)?1:0);
	}
}
void c_XMLNode::p_SetAttribute3(String t_id,int t_value){
	DBG_ENTER("XMLNode.SetAttribute")
	c_XMLNode *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_id,"id")
	DBG_LOCAL(t_value,"value")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1506>");
	if(m_valid==false){
		DBG_BLOCK();
		return;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1509>");
	t_id=t_id.ToLower();
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1512>");
	c_XMLAttribute* t_attribute=m_attributes->p_Get2(t_id);
	DBG_LOCAL(t_attribute,"attribute")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1513>");
	if(t_attribute==0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1515>");
		m_attributes->p_Insert4(t_id,(new c_XMLAttribute)->m_new(t_id,String(t_value)));
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1518>");
		t_attribute->m_value=String(t_value);
	}
}
void c_XMLNode::p_SetAttribute4(String t_id,Float t_value){
	DBG_ENTER("XMLNode.SetAttribute")
	c_XMLNode *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_id,"id")
	DBG_LOCAL(t_value,"value")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1525>");
	if(m_valid==false){
		DBG_BLOCK();
		return;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1528>");
	t_id=t_id.ToLower();
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1531>");
	c_XMLAttribute* t_attribute=m_attributes->p_Get2(t_id);
	DBG_LOCAL(t_attribute,"attribute")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1532>");
	if(t_attribute==0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1534>");
		m_attributes->p_Insert4(t_id,(new c_XMLAttribute)->m_new(t_id,String(t_value)));
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1537>");
		t_attribute->m_value=String(t_value);
	}
}
void c_XMLNode::p_SetAttribute5(String t_id,String t_value){
	DBG_ENTER("XMLNode.SetAttribute")
	c_XMLNode *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_id,"id")
	DBG_LOCAL(t_value,"value")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1544>");
	if(m_valid==false){
		DBG_BLOCK();
		return;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1547>");
	t_id=t_id.ToLower();
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1550>");
	c_XMLAttribute* t_attribute=m_attributes->p_Get2(t_id);
	DBG_LOCAL(t_attribute,"attribute")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1551>");
	if(t_attribute==0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1553>");
		m_attributes->p_Insert4(t_id,(new c_XMLAttribute)->m_new(t_id,t_value));
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1556>");
		t_attribute->m_value=t_value;
	}
}
c_XMLNode* c_XMLNode::p_AddChild(String t_name,String t_attributes,String t_value){
	DBG_ENTER("XMLNode.AddChild")
	c_XMLNode *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_name,"name")
	DBG_LOCAL(t_attributes,"attributes")
	DBG_LOCAL(t_value,"value")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<802>");
	if(m_valid==false || m_text){
		DBG_BLOCK();
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<805>");
	c_XMLNode* t_child=(new c_XMLNode)->m_new(t_name,true);
	DBG_LOCAL(t_child,"child")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<806>");
	gc_assign(t_child->m_doc,m_doc);
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<807>");
	gc_assign(t_child->m_parent,this);
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<808>");
	t_child->m_value=t_value;
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<811>");
	t_child->m_path=m_path+String(L"/",1)+t_child->m_name;
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<812>");
	gc_assign(t_child->m_pathList,m_doc->m_paths->p_Get2(t_child->m_path));
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<813>");
	if(t_child->m_pathList==0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<815>");
		gc_assign(t_child->m_pathList,(new c_List13)->m_new());
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<816>");
		m_doc->m_paths->p_Set5(t_child->m_path,t_child->m_pathList);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<818>");
	gc_assign(t_child->m_pathListNode,t_child->m_pathList->p_AddLast13(t_child));
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<821>");
	if((t_attributes.Length())!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<822>");
		c_XMLAttributeQuery* t_query=(new c_XMLAttributeQuery)->m_new(t_attributes);
		DBG_LOCAL(t_query,"query")
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<823>");
		if(t_query->p_Length2()>0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<824>");
			for(int t_index=0;t_index<t_query->p_Length2();t_index=t_index+1){
				DBG_BLOCK();
				DBG_LOCAL(t_index,"index")
				DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<825>");
				t_child->p_SetAttribute5(t_query->m_items.At(t_index)->m_id,t_query->m_items.At(t_index)->m_value);
			}
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<831>");
	if((m_lastChild)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<834>");
		gc_assign(m_lastChild->m_nextSibling,t_child);
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<837>");
		gc_assign(t_child->m_previousSibling,m_lastChild);
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<840>");
		gc_assign(m_lastChild,t_child);
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<843>");
		gc_assign(m_firstChild,t_child);
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<844>");
		gc_assign(m_lastChild,t_child);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<848>");
	m_children->p_AddLast13(t_child);
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<851>");
	return t_child;
}
c_XMLNode* c_XMLNode::p_GetChild(bool t_text){
	DBG_ENTER("XMLNode.GetChild")
	c_XMLNode *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_text,"text")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1089>");
	if(m_firstChild==0){
		DBG_BLOCK();
		return m_doc->m_nullNode;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1092>");
	if(t_text || m_firstChild->m_text==false){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1093>");
		return m_firstChild;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1097>");
	c_XMLNode* t_child=m_firstChild;
	DBG_LOCAL(t_child,"child")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1098>");
	while((t_child)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1100>");
		if(t_child->m_text==false){
			DBG_BLOCK();
			return t_child;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1103>");
		t_child=t_child->m_nextSibling;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1107>");
	return m_doc->m_nullNode;
}
c_XMLNode* c_XMLNode::p_GetChild2(String t_name,bool t_text){
	DBG_ENTER("XMLNode.GetChild")
	c_XMLNode *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_name,"name")
	DBG_LOCAL(t_text,"text")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1113>");
	if(m_firstChild==0){
		DBG_BLOCK();
		return m_doc->m_nullNode;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1116>");
	t_name=t_name.ToLower();
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1119>");
	c_XMLNode* t_child=m_firstChild;
	DBG_LOCAL(t_child,"child")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1120>");
	while((t_child)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1122>");
		if(t_child->m_name==t_name && (t_text || t_child->m_text==false)){
			DBG_BLOCK();
			return t_child;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1125>");
		t_child=t_child->m_nextSibling;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1129>");
	return m_doc->m_nullNode;
}
c_XMLAttribute* c_XMLNode::p_GetXMLAttribute(String t_id){
	DBG_ENTER("XMLNode.GetXMLAttribute")
	c_XMLNode *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_id,"id")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<743>");
	c_XMLAttribute* t_=m_attributes->p_Get2(t_id.ToLower());
	return t_;
}
c_XMLNode* c_XMLNode::p_GetChild3(String t_name,String t_attributes,bool t_text){
	DBG_ENTER("XMLNode.GetChild")
	c_XMLNode *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_name,"name")
	DBG_LOCAL(t_attributes,"attributes")
	DBG_LOCAL(t_text,"text")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1135>");
	if(m_firstChild==0){
		DBG_BLOCK();
		return m_doc->m_nullNode;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1138>");
	t_name=t_name.ToLower();
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1141>");
	c_XMLAttributeQuery* t_query=(new c_XMLAttributeQuery)->m_new(t_attributes);
	DBG_LOCAL(t_query,"query")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1144>");
	c_XMLNode* t_child=m_firstChild;
	DBG_LOCAL(t_child,"child")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1145>");
	while((t_child)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1147>");
		if(t_child->m_name==t_name && (t_text || t_child->m_text==false) && t_query->p_Test(t_child)){
			DBG_BLOCK();
			return t_child;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1150>");
		t_child=t_child->m_nextSibling;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1154>");
	return m_doc->m_nullNode;
}
c_List13* c_XMLNode::p_GetChildren(c_List13* t_result,bool t_text){
	DBG_ENTER("XMLNode.GetChildren")
	c_XMLNode *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_result,"result")
	DBG_LOCAL(t_text,"text")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1159>");
	if(t_result==0){
		DBG_BLOCK();
		t_result=(new c_List13)->m_new();
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1162>");
	if(m_firstChild==0){
		DBG_BLOCK();
		return t_result;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1165>");
	if(m_firstChild!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1166>");
		c_XMLNode* t_child=m_firstChild;
		DBG_LOCAL(t_child,"child")
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1167>");
		while((t_child)!=0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1169>");
			if(t_text || t_child->m_text==false){
				DBG_BLOCK();
				t_result->p_AddLast13(t_child);
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1172>");
			t_child=t_child->m_nextSibling;
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1177>");
	return t_result;
}
c_List13* c_XMLNode::p_GetChildren2(String t_name,c_List13* t_result,bool t_text){
	DBG_ENTER("XMLNode.GetChildren")
	c_XMLNode *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_name,"name")
	DBG_LOCAL(t_result,"result")
	DBG_LOCAL(t_text,"text")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1182>");
	if(t_result==0){
		DBG_BLOCK();
		t_result=(new c_List13)->m_new();
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1185>");
	if(m_firstChild==0 || t_name.Length()==0){
		DBG_BLOCK();
		return t_result;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1188>");
	t_name=t_name.ToLower();
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1191>");
	if(m_firstChild!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1192>");
		c_XMLNode* t_child=m_firstChild;
		DBG_LOCAL(t_child,"child")
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1193>");
		while((t_child)!=0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1195>");
			if(t_child->m_name==t_name && (t_text || t_child->m_text==false)){
				DBG_BLOCK();
				t_result->p_AddLast13(t_child);
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1198>");
			t_child=t_child->m_nextSibling;
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1203>");
	return t_result;
}
c_List13* c_XMLNode::p_GetChildren3(String t_name,String t_attributes,c_List13* t_result,bool t_text){
	DBG_ENTER("XMLNode.GetChildren")
	c_XMLNode *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_name,"name")
	DBG_LOCAL(t_attributes,"attributes")
	DBG_LOCAL(t_result,"result")
	DBG_LOCAL(t_text,"text")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1208>");
	if(t_result==0){
		DBG_BLOCK();
		t_result=(new c_List13)->m_new();
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1211>");
	if(m_firstChild==0 || t_name.Length()==0 && t_attributes.Length()==0){
		DBG_BLOCK();
		return t_result;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1214>");
	t_name=t_name.ToLower();
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1217>");
	c_XMLAttributeQuery* t_query=(new c_XMLAttributeQuery)->m_new(t_attributes);
	DBG_LOCAL(t_query,"query")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1220>");
	if(m_firstChild!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1221>");
		c_XMLNode* t_child=m_firstChild;
		DBG_LOCAL(t_child,"child")
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1222>");
		while((t_child)!=0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1224>");
			if((t_name.Length()==0 || t_child->m_name==t_name) && (t_text || t_child->m_text==false) && t_query->p_Test(t_child)){
				DBG_BLOCK();
				t_result->p_AddLast13(t_child);
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1227>");
			t_child=t_child->m_nextSibling;
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1232>");
	return t_result;
}
void c_XMLNode::mark(){
	Object::mark();
	gc_mark_q(m_doc);
	gc_mark_q(m_parent);
	gc_mark_q(m_lastChild);
	gc_mark_q(m_nextSibling);
	gc_mark_q(m_previousSibling);
	gc_mark_q(m_firstChild);
	gc_mark_q(m_children);
	gc_mark_q(m_pathList);
	gc_mark_q(m_pathListNode);
	gc_mark_q(m_attributes);
}
String c_XMLNode::debug(){
	String t="(XMLNode)\n";
	t+=dbg_decl("text",&m_text);
	t+=dbg_decl("valid",&m_valid);
	t+=dbg_decl("name",&m_name);
	t+=dbg_decl("value",&m_value);
	t+=dbg_decl("path",&m_path);
	t+=dbg_decl("doc",&m_doc);
	t+=dbg_decl("parent",&m_parent);
	t+=dbg_decl("nextSibling",&m_nextSibling);
	t+=dbg_decl("previousSibling",&m_previousSibling);
	t+=dbg_decl("firstChild",&m_firstChild);
	t+=dbg_decl("lastChild",&m_lastChild);
	t+=dbg_decl("line",&m_line);
	t+=dbg_decl("column",&m_column);
	t+=dbg_decl("offset",&m_offset);
	t+=dbg_decl("children",&m_children);
	t+=dbg_decl("attributes",&m_attributes);
	t+=dbg_decl("pathList",&m_pathList);
	t+=dbg_decl("pathListNode",&m_pathListNode);
	return t;
}
c_XMLDoc::c_XMLDoc(){
	m_nullNode=0;
	m_version=String();
	m_encoding=String();
	m_paths=(new c_StringMap2)->m_new();
}
c_XMLDoc* c_XMLDoc::m_new(String t_name,String t_version,String t_encoding){
	DBG_ENTER("XMLDoc.new")
	c_XMLDoc *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_name,"name")
	DBG_LOCAL(t_version,"version")
	DBG_LOCAL(t_encoding,"encoding")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<542>");
	c_XMLNode::m_new2();
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<544>");
	m_valid=true;
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<547>");
	gc_assign(m_doc,this);
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<550>");
	gc_assign(m_nullNode,(new c_XMLNode)->m_new(String(),false));
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<551>");
	gc_assign(m_nullNode->m_doc,this);
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<554>");
	this->m_name=t_name.ToLower();
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<555>");
	this->m_version=t_version;
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<556>");
	this->m_encoding=t_encoding;
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<559>");
	m_path=t_name;
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<560>");
	gc_assign(m_pathList,(new c_List13)->m_new());
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<561>");
	gc_assign(m_pathListNode,m_pathList->p_AddLast13(this));
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<562>");
	m_paths->p_Insert3(m_path,m_pathList);
	return this;
}
c_XMLDoc* c_XMLDoc::m_new2(){
	DBG_ENTER("XMLDoc.new")
	c_XMLDoc *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<535>");
	c_XMLNode::m_new2();
	return this;
}
void c_XMLDoc::mark(){
	c_XMLNode::mark();
	gc_mark_q(m_nullNode);
	gc_mark_q(m_paths);
}
String c_XMLDoc::debug(){
	String t="(XMLDoc)\n";
	t=c_XMLNode::debug()+t;
	t+=dbg_decl("nullNode",&m_nullNode);
	t+=dbg_decl("version",&m_version);
	t+=dbg_decl("encoding",&m_encoding);
	t+=dbg_decl("paths",&m_paths);
	return t;
}
c_XMLStringBuffer::c_XMLStringBuffer(){
	m_chunk=128;
	m_count=0;
	m_data=Array<int >();
	m_dirty=0;
	m_cache=String();
}
c_XMLStringBuffer* c_XMLStringBuffer::m_new(int t_chunk){
	DBG_ENTER("XMLStringBuffer.new")
	c_XMLStringBuffer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_chunk,"chunk")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<136>");
	this->m_chunk=t_chunk;
	return this;
}
int c_XMLStringBuffer::p_Length2(){
	DBG_ENTER("XMLStringBuffer.Length")
	c_XMLStringBuffer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<287>");
	return m_count;
}
int c_XMLStringBuffer::p_Last(int t_defaultValue){
	DBG_ENTER("XMLStringBuffer.Last")
	c_XMLStringBuffer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_defaultValue,"defaultValue")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<293>");
	if(m_count==0){
		DBG_BLOCK();
		return t_defaultValue;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<296>");
	int t_=m_data.At(m_count-1);
	return t_;
}
void c_XMLStringBuffer::p_Add4(int t_asc){
	DBG_ENTER("XMLStringBuffer.Add")
	c_XMLStringBuffer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_asc,"asc")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<160>");
	if(m_count==m_data.Length()){
		DBG_BLOCK();
		gc_assign(m_data,m_data.Resize(m_data.Length()+m_chunk));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<163>");
	m_data.At(m_count)=t_asc;
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<166>");
	m_count+=1;
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<169>");
	m_dirty=1;
}
void c_XMLStringBuffer::p_Add5(String t_text){
	DBG_ENTER("XMLStringBuffer.Add")
	c_XMLStringBuffer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_text,"text")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<174>");
	if(t_text.Length()==0){
		DBG_BLOCK();
		return;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<177>");
	if(m_count+t_text.Length()>=m_data.Length()){
		DBG_BLOCK();
		gc_assign(m_data,m_data.Resize(int(Float(m_data.Length())+Float(m_chunk)*(Float)ceil(Float(t_text.Length())/Float(m_chunk)))));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<180>");
	for(int t_textIndex=0;t_textIndex<t_text.Length();t_textIndex=t_textIndex+1){
		DBG_BLOCK();
		DBG_LOCAL(t_textIndex,"textIndex")
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<181>");
		m_data.At(m_count)=(int)t_text.At(t_textIndex);
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<184>");
		m_count+=1;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<188>");
	m_dirty=1;
}
void c_XMLStringBuffer::p_Add6(String t_text,int t_offset,int t_suggestedLength){
	DBG_ENTER("XMLStringBuffer.Add")
	c_XMLStringBuffer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_text,"text")
	DBG_LOCAL(t_offset,"offset")
	DBG_LOCAL(t_suggestedLength,"suggestedLength")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<194>");
	int t_realLength=t_text.Length()-t_offset;
	DBG_LOCAL(t_realLength,"realLength")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<195>");
	if(t_suggestedLength>0 && t_suggestedLength<t_realLength){
		DBG_BLOCK();
		t_realLength=t_suggestedLength;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<198>");
	if(t_realLength==0){
		DBG_BLOCK();
		return;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<201>");
	if(m_count+t_realLength>=m_data.Length()){
		DBG_BLOCK();
		gc_assign(m_data,m_data.Resize(int(Float(m_data.Length())+Float(m_chunk)*(Float)ceil(Float(t_realLength)/Float(m_chunk)))));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<204>");
	for(int t_textIndex=t_offset;t_textIndex<t_offset+t_realLength;t_textIndex=t_textIndex+1){
		DBG_BLOCK();
		DBG_LOCAL(t_textIndex,"textIndex")
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<205>");
		m_data.At(m_count)=(int)t_text.At(t_textIndex);
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<208>");
		m_count+=1;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<212>");
	m_dirty=1;
}
void c_XMLStringBuffer::p_Clear(){
	DBG_ENTER("XMLStringBuffer.Clear")
	c_XMLStringBuffer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<217>");
	m_count=0;
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<218>");
	m_cache=String();
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<219>");
	m_dirty=0;
}
bool c_XMLStringBuffer::p_Trim(){
	DBG_ENTER("XMLStringBuffer.Trim")
	c_XMLStringBuffer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<241>");
	if(m_count==0){
		DBG_BLOCK();
		return false;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<244>");
	if(m_count==1 && (m_data.At(0)==32 || m_data.At(0)==9 || m_data.At(0)==10) || m_count==2 && (m_data.At(0)==32 || m_data.At(0)==9 || m_data.At(0)==10) && (m_data.At(1)==32 || m_data.At(1)==9 || m_data.At(1)==10)){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<245>");
		p_Clear();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<246>");
		return true;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<251>");
	int t_startIndex=0;
	DBG_LOCAL(t_startIndex,"startIndex")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<252>");
	for(t_startIndex=0;t_startIndex<m_count;t_startIndex=t_startIndex+1){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<253>");
		if(m_data.At(t_startIndex)!=32 && m_data.At(t_startIndex)!=9 && m_data.At(t_startIndex)!=10){
			DBG_BLOCK();
			break;
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<257>");
	if(t_startIndex==m_count){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<258>");
		p_Clear();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<259>");
		return true;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<263>");
	int t_endIndex=0;
	DBG_LOCAL(t_endIndex,"endIndex")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<264>");
	for(t_endIndex=m_count-1;t_endIndex>=0;t_endIndex=t_endIndex+-1){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<265>");
		if(m_data.At(t_endIndex)!=32 && m_data.At(t_endIndex)!=9 && m_data.At(t_endIndex)!=10){
			DBG_BLOCK();
			break;
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<269>");
	if(t_startIndex==0 && t_endIndex==m_count-1){
		DBG_BLOCK();
		return false;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<272>");
	m_count=t_endIndex-t_startIndex+1;
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<275>");
	if(t_startIndex>0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<276>");
		for(int t_trimIndex=0;t_trimIndex<m_count;t_trimIndex=t_trimIndex+1){
			DBG_BLOCK();
			DBG_LOCAL(t_trimIndex,"trimIndex")
			DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<277>");
			m_data.At(t_trimIndex)=m_data.At(t_trimIndex+t_startIndex);
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<282>");
	return true;
}
String c_XMLStringBuffer::p_value(){
	DBG_ENTER("XMLStringBuffer.value")
	c_XMLStringBuffer *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<143>");
	if((m_dirty)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<144>");
		m_dirty=0;
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<145>");
		if(m_count==0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<146>");
			m_cache=String();
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<148>");
			m_cache=String::FromChars(m_data.Slice(0,m_count));
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<153>");
	return m_cache;
}
void c_XMLStringBuffer::mark(){
	Object::mark();
	gc_mark_q(m_data);
}
String c_XMLStringBuffer::debug(){
	String t="(XMLStringBuffer)\n";
	t+=dbg_decl("data",&m_data);
	t+=dbg_decl("chunk",&m_chunk);
	t+=dbg_decl("count",&m_count);
	t+=dbg_decl("dirty",&m_dirty);
	t+=dbg_decl("cache",&m_cache);
	return t;
}
c_List13::c_List13(){
	m__head=((new c_HeadNode13)->m_new());
}
c_List13* c_List13::m_new(){
	DBG_ENTER("List.new")
	c_List13 *self=this;
	DBG_LOCAL(self,"Self")
	return this;
}
c_Node16* c_List13::p_AddLast13(c_XMLNode* t_data){
	DBG_ENTER("List.AddLast")
	c_List13 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<108>");
	c_Node16* t_=(new c_Node16)->m_new(m__head,m__head->m__pred,t_data);
	return t_;
}
c_List13* c_List13::m_new2(Array<c_XMLNode* > t_data){
	DBG_ENTER("List.new")
	c_List13 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<13>");
	Array<c_XMLNode* > t_=t_data;
	int t_2=0;
	while(t_2<t_.Length()){
		DBG_BLOCK();
		c_XMLNode* t_t=t_.At(t_2);
		t_2=t_2+1;
		DBG_LOCAL(t_t,"t")
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<14>");
		p_AddLast13(t_t);
	}
	return this;
}
bool c_List13::p_IsEmpty(){
	DBG_ENTER("List.IsEmpty")
	c_List13 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<50>");
	bool t_=m__head->m__succ==m__head;
	return t_;
}
c_XMLNode* c_List13::p_RemoveLast(){
	DBG_ENTER("List.RemoveLast")
	c_List13 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<96>");
	if(p_IsEmpty()){
		DBG_BLOCK();
		bbError(String(L"Illegal operation on empty list",31));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<98>");
	c_XMLNode* t_data=m__head->m__pred->m__data;
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<99>");
	m__head->m__pred->p_Remove();
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<100>");
	return t_data;
}
bool c_List13::p_Equals4(c_XMLNode* t_lhs,c_XMLNode* t_rhs){
	DBG_ENTER("List.Equals")
	c_List13 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_lhs,"lhs")
	DBG_LOCAL(t_rhs,"rhs")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<28>");
	bool t_=t_lhs==t_rhs;
	return t_;
}
c_Node16* c_List13::p_FindLast(c_XMLNode* t_value,c_Node16* t_start){
	DBG_ENTER("List.FindLast")
	c_List13 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_value,"value")
	DBG_LOCAL(t_start,"start")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<128>");
	while(t_start!=m__head){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<129>");
		if(p_Equals4(t_value,t_start->m__data)){
			DBG_BLOCK();
			return t_start;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<130>");
		t_start=t_start->m__pred;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<132>");
	return 0;
}
c_Node16* c_List13::p_FindLast2(c_XMLNode* t_value){
	DBG_ENTER("List.FindLast")
	c_List13 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_value,"value")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<124>");
	c_Node16* t_=p_FindLast(t_value,m__head->m__pred);
	return t_;
}
void c_List13::p_RemoveLast2(c_XMLNode* t_value){
	DBG_ENTER("List.RemoveLast")
	c_List13 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_value,"value")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<146>");
	c_Node16* t_node=p_FindLast2(t_value);
	DBG_LOCAL(t_node,"node")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<147>");
	if((t_node)!=0){
		DBG_BLOCK();
		t_node->p_Remove();
	}
}
c_XMLNode* c_List13::p_Last2(){
	DBG_ENTER("List.Last")
	c_List13 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<80>");
	if(p_IsEmpty()){
		DBG_BLOCK();
		bbError(String(L"Illegal operation on empty list",31));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<82>");
	return m__head->m__pred->m__data;
}
c_Enumerator15* c_List13::p_ObjectEnumerator(){
	DBG_ENTER("List.ObjectEnumerator")
	c_List13 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<186>");
	c_Enumerator15* t_=(new c_Enumerator15)->m_new(this);
	return t_;
}
void c_List13::mark(){
	Object::mark();
	gc_mark_q(m__head);
}
String c_List13::debug(){
	String t="(List)\n";
	t+=dbg_decl("_head",&m__head);
	return t;
}
c_Node16::c_Node16(){
	m__succ=0;
	m__pred=0;
	m__data=0;
}
c_Node16* c_Node16::m_new(c_Node16* t_succ,c_Node16* t_pred,c_XMLNode* t_data){
	DBG_ENTER("Node.new")
	c_Node16 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_succ,"succ")
	DBG_LOCAL(t_pred,"pred")
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<261>");
	gc_assign(m__succ,t_succ);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<262>");
	gc_assign(m__pred,t_pred);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<263>");
	gc_assign(m__succ->m__pred,this);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<264>");
	gc_assign(m__pred->m__succ,this);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<265>");
	gc_assign(m__data,t_data);
	return this;
}
c_Node16* c_Node16::m_new2(){
	DBG_ENTER("Node.new")
	c_Node16 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<258>");
	return this;
}
int c_Node16::p_Remove(){
	DBG_ENTER("Node.Remove")
	c_Node16 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<274>");
	if(m__succ->m__pred!=this){
		DBG_BLOCK();
		bbError(String(L"Illegal operation on removed node",33));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<276>");
	gc_assign(m__succ->m__pred,m__pred);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<277>");
	gc_assign(m__pred->m__succ,m__succ);
	return 0;
}
void c_Node16::mark(){
	Object::mark();
	gc_mark_q(m__succ);
	gc_mark_q(m__pred);
	gc_mark_q(m__data);
}
String c_Node16::debug(){
	String t="(Node)\n";
	t+=dbg_decl("_succ",&m__succ);
	t+=dbg_decl("_pred",&m__pred);
	t+=dbg_decl("_data",&m__data);
	return t;
}
c_HeadNode13::c_HeadNode13(){
}
c_HeadNode13* c_HeadNode13::m_new(){
	DBG_ENTER("HeadNode.new")
	c_HeadNode13 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<310>");
	c_Node16::m_new2();
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<311>");
	gc_assign(m__succ,(this));
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<312>");
	gc_assign(m__pred,(this));
	return this;
}
void c_HeadNode13::mark(){
	c_Node16::mark();
}
String c_HeadNode13::debug(){
	String t="(HeadNode)\n";
	t=c_Node16::debug()+t;
	return t;
}
bool bb_xml_XMLHasStringAtOffset(String t_needle,String t_haystack,int t_offset){
	DBG_ENTER("XMLHasStringAtOffset")
	DBG_LOCAL(t_needle,"needle")
	DBG_LOCAL(t_haystack,"haystack")
	DBG_LOCAL(t_offset,"offset")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<473>");
	if(t_offset+t_needle.Length()>t_haystack.Length()){
		DBG_BLOCK();
		return false;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<476>");
	for(int t_index=0;t_index<t_needle.Length();t_index=t_index+1){
		DBG_BLOCK();
		DBG_LOCAL(t_index,"index")
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<477>");
		if((int)t_needle.At(t_index)!=(int)t_haystack.At(t_offset+t_index)){
			DBG_BLOCK();
			return false;
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<481>");
	return true;
}
int bb_xml_XMLFindNextAsc(String t_data,int t_asc,int t_offset){
	DBG_ENTER("XMLFindNextAsc")
	DBG_LOCAL(t_data,"data")
	DBG_LOCAL(t_asc,"asc")
	DBG_LOCAL(t_offset,"offset")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<486>");
	int t_length=t_data.Length();
	DBG_LOCAL(t_length,"length")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<489>");
	if(t_offset>=t_length){
		DBG_BLOCK();
		return -1;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<492>");
	if(t_offset<0){
		DBG_BLOCK();
		t_offset=0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<495>");
	for(t_offset=t_offset;t_offset<t_length;t_offset=t_offset+1){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<496>");
		if((int)t_data.At(t_offset)==t_asc){
			DBG_BLOCK();
			return t_offset;
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<500>");
	return -1;
}
int bb_xml_XMLFindStringNotInQuotes(String t_needle,String t_haystack,int t_offset){
	DBG_ENTER("XMLFindStringNotInQuotes")
	DBG_LOCAL(t_needle,"needle")
	DBG_LOCAL(t_haystack,"haystack")
	DBG_LOCAL(t_offset,"offset")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<505>");
	int t_needlePos=0;
	DBG_LOCAL(t_needlePos,"needlePos")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<506>");
	do{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<508>");
		t_needlePos=t_haystack.Find(t_needle,t_offset);
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<509>");
		if(t_needlePos==-1){
			DBG_BLOCK();
			return -1;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<512>");
		t_offset=bb_xml_XMLFindNextAsc(t_haystack,34,t_offset);
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<515>");
		if(t_needlePos<t_offset || t_offset==-1){
			DBG_BLOCK();
			return t_needlePos;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<518>");
		t_offset=bb_xml_XMLFindNextAsc(t_haystack,34,t_offset+1);
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<519>");
		if(t_offset==-1){
			DBG_BLOCK();
			return -1;
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<520>");
		t_offset+=1;
	}while(!(false));
}
c_Map6::c_Map6(){
	m_root=0;
}
c_Map6* c_Map6::m_new(){
	DBG_ENTER("Map.new")
	c_Map6 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<7>");
	return this;
}
int c_Map6::p_RotateLeft4(c_Node17* t_node){
	DBG_ENTER("Map.RotateLeft")
	c_Map6 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_node,"node")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<251>");
	c_Node17* t_child=t_node->m_right;
	DBG_LOCAL(t_child,"child")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<252>");
	gc_assign(t_node->m_right,t_child->m_left);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<253>");
	if((t_child->m_left)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<254>");
		gc_assign(t_child->m_left->m_parent,t_node);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<256>");
	gc_assign(t_child->m_parent,t_node->m_parent);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<257>");
	if((t_node->m_parent)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<258>");
		if(t_node==t_node->m_parent->m_left){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<259>");
			gc_assign(t_node->m_parent->m_left,t_child);
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<261>");
			gc_assign(t_node->m_parent->m_right,t_child);
		}
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<264>");
		gc_assign(m_root,t_child);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<266>");
	gc_assign(t_child->m_left,t_node);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<267>");
	gc_assign(t_node->m_parent,t_child);
	return 0;
}
int c_Map6::p_RotateRight4(c_Node17* t_node){
	DBG_ENTER("Map.RotateRight")
	c_Map6 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_node,"node")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<271>");
	c_Node17* t_child=t_node->m_left;
	DBG_LOCAL(t_child,"child")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<272>");
	gc_assign(t_node->m_left,t_child->m_right);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<273>");
	if((t_child->m_right)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<274>");
		gc_assign(t_child->m_right->m_parent,t_node);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<276>");
	gc_assign(t_child->m_parent,t_node->m_parent);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<277>");
	if((t_node->m_parent)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<278>");
		if(t_node==t_node->m_parent->m_right){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<279>");
			gc_assign(t_node->m_parent->m_right,t_child);
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<281>");
			gc_assign(t_node->m_parent->m_left,t_child);
		}
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<284>");
		gc_assign(m_root,t_child);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<286>");
	gc_assign(t_child->m_right,t_node);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<287>");
	gc_assign(t_node->m_parent,t_child);
	return 0;
}
int c_Map6::p_InsertFixup4(c_Node17* t_node){
	DBG_ENTER("Map.InsertFixup")
	c_Map6 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_node,"node")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<212>");
	while(((t_node->m_parent)!=0) && t_node->m_parent->m_color==-1 && ((t_node->m_parent->m_parent)!=0)){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<213>");
		if(t_node->m_parent==t_node->m_parent->m_parent->m_left){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<214>");
			c_Node17* t_uncle=t_node->m_parent->m_parent->m_right;
			DBG_LOCAL(t_uncle,"uncle")
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<215>");
			if(((t_uncle)!=0) && t_uncle->m_color==-1){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<216>");
				t_node->m_parent->m_color=1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<217>");
				t_uncle->m_color=1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<218>");
				t_uncle->m_parent->m_color=-1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<219>");
				t_node=t_uncle->m_parent;
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<221>");
				if(t_node==t_node->m_parent->m_right){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<222>");
					t_node=t_node->m_parent;
					DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<223>");
					p_RotateLeft4(t_node);
				}
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<225>");
				t_node->m_parent->m_color=1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<226>");
				t_node->m_parent->m_parent->m_color=-1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<227>");
				p_RotateRight4(t_node->m_parent->m_parent);
			}
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<230>");
			c_Node17* t_uncle2=t_node->m_parent->m_parent->m_left;
			DBG_LOCAL(t_uncle2,"uncle")
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<231>");
			if(((t_uncle2)!=0) && t_uncle2->m_color==-1){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<232>");
				t_node->m_parent->m_color=1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<233>");
				t_uncle2->m_color=1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<234>");
				t_uncle2->m_parent->m_color=-1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<235>");
				t_node=t_uncle2->m_parent;
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<237>");
				if(t_node==t_node->m_parent->m_left){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<238>");
					t_node=t_node->m_parent;
					DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<239>");
					p_RotateRight4(t_node);
				}
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<241>");
				t_node->m_parent->m_color=1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<242>");
				t_node->m_parent->m_parent->m_color=-1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<243>");
				p_RotateLeft4(t_node->m_parent->m_parent);
			}
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<247>");
	m_root->m_color=1;
	return 0;
}
bool c_Map6::p_Set5(String t_key,c_List13* t_value){
	DBG_ENTER("Map.Set")
	c_Map6 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_key,"key")
	DBG_LOCAL(t_value,"value")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<29>");
	c_Node17* t_node=m_root;
	DBG_LOCAL(t_node,"node")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<30>");
	c_Node17* t_parent=0;
	int t_cmp=0;
	DBG_LOCAL(t_parent,"parent")
	DBG_LOCAL(t_cmp,"cmp")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<32>");
	while((t_node)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<33>");
		t_parent=t_node;
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<34>");
		t_cmp=p_Compare3(t_key,t_node->m_key);
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<35>");
		if(t_cmp>0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<36>");
			t_node=t_node->m_right;
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<37>");
			if(t_cmp<0){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<38>");
				t_node=t_node->m_left;
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<40>");
				gc_assign(t_node->m_value,t_value);
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<41>");
				return false;
			}
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<45>");
	t_node=(new c_Node17)->m_new(t_key,t_value,-1,t_parent);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<47>");
	if((t_parent)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<48>");
		if(t_cmp>0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<49>");
			gc_assign(t_parent->m_right,t_node);
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<51>");
			gc_assign(t_parent->m_left,t_node);
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<53>");
		p_InsertFixup4(t_node);
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<55>");
		gc_assign(m_root,t_node);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<57>");
	return true;
}
bool c_Map6::p_Insert3(String t_key,c_List13* t_value){
	DBG_ENTER("Map.Insert")
	c_Map6 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_key,"key")
	DBG_LOCAL(t_value,"value")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<126>");
	bool t_=p_Set5(t_key,t_value);
	return t_;
}
c_Node17* c_Map6::p_FindNode2(String t_key){
	DBG_ENTER("Map.FindNode")
	c_Map6 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_key,"key")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<157>");
	c_Node17* t_node=m_root;
	DBG_LOCAL(t_node,"node")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<159>");
	while((t_node)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<160>");
		int t_cmp=p_Compare3(t_key,t_node->m_key);
		DBG_LOCAL(t_cmp,"cmp")
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<161>");
		if(t_cmp>0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<162>");
			t_node=t_node->m_right;
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<163>");
			if(t_cmp<0){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<164>");
				t_node=t_node->m_left;
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<166>");
				return t_node;
			}
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<169>");
	return t_node;
}
c_List13* c_Map6::p_Get2(String t_key){
	DBG_ENTER("Map.Get")
	c_Map6 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_key,"key")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<101>");
	c_Node17* t_node=p_FindNode2(t_key);
	DBG_LOCAL(t_node,"node")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<102>");
	if((t_node)!=0){
		DBG_BLOCK();
		return t_node->m_value;
	}
	return 0;
}
void c_Map6::mark(){
	Object::mark();
	gc_mark_q(m_root);
}
String c_Map6::debug(){
	String t="(Map)\n";
	t+=dbg_decl("root",&m_root);
	return t;
}
c_StringMap2::c_StringMap2(){
}
c_StringMap2* c_StringMap2::m_new(){
	DBG_ENTER("StringMap.new")
	c_StringMap2 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<551>");
	c_Map6::m_new();
	return this;
}
int c_StringMap2::p_Compare3(String t_lhs,String t_rhs){
	DBG_ENTER("StringMap.Compare")
	c_StringMap2 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_lhs,"lhs")
	DBG_LOCAL(t_rhs,"rhs")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<554>");
	int t_=t_lhs.Compare(t_rhs);
	return t_;
}
void c_StringMap2::mark(){
	c_Map6::mark();
}
String c_StringMap2::debug(){
	String t="(StringMap)\n";
	t=c_Map6::debug()+t;
	return t;
}
c_Node17::c_Node17(){
	m_key=String();
	m_right=0;
	m_left=0;
	m_value=0;
	m_color=0;
	m_parent=0;
}
c_Node17* c_Node17::m_new(String t_key,c_List13* t_value,int t_color,c_Node17* t_parent){
	DBG_ENTER("Node.new")
	c_Node17 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_key,"key")
	DBG_LOCAL(t_value,"value")
	DBG_LOCAL(t_color,"color")
	DBG_LOCAL(t_parent,"parent")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<364>");
	this->m_key=t_key;
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<365>");
	gc_assign(this->m_value,t_value);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<366>");
	this->m_color=t_color;
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<367>");
	gc_assign(this->m_parent,t_parent);
	return this;
}
c_Node17* c_Node17::m_new2(){
	DBG_ENTER("Node.new")
	c_Node17 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<361>");
	return this;
}
void c_Node17::mark(){
	Object::mark();
	gc_mark_q(m_right);
	gc_mark_q(m_left);
	gc_mark_q(m_value);
	gc_mark_q(m_parent);
}
String c_Node17::debug(){
	String t="(Node)\n";
	t+=dbg_decl("key",&m_key);
	t+=dbg_decl("value",&m_value);
	t+=dbg_decl("color",&m_color);
	t+=dbg_decl("parent",&m_parent);
	t+=dbg_decl("left",&m_left);
	t+=dbg_decl("right",&m_right);
	return t;
}
c_XMLAttributeQuery::c_XMLAttributeQuery(){
	m_count=0;
	m_items=Array<c_XMLAttributeQueryItem* >();
	m_chunk=32;
}
c_XMLAttributeQuery* c_XMLAttributeQuery::m_new(String t_query){
	DBG_ENTER("XMLAttributeQuery.new")
	c_XMLAttributeQuery *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_query,"query")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<311>");
	int t_queryIndex=0;
	DBG_LOCAL(t_queryIndex,"queryIndex")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<312>");
	int t_queryAsc=0;
	DBG_LOCAL(t_queryAsc,"queryAsc")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<314>");
	c_XMLStringBuffer* t_buffer=(new c_XMLStringBuffer)->m_new(256);
	DBG_LOCAL(t_buffer,"buffer")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<316>");
	bool t_isEscaped=false;
	DBG_LOCAL(t_isEscaped,"isEscaped")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<318>");
	bool t_processBuffer=false;
	DBG_LOCAL(t_processBuffer,"processBuffer")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<319>");
	bool t_processItem=false;
	DBG_LOCAL(t_processItem,"processItem")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<321>");
	bool t_hasId=false;
	DBG_LOCAL(t_hasId,"hasId")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<322>");
	bool t_hasValue=false;
	DBG_LOCAL(t_hasValue,"hasValue")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<323>");
	bool t_hasEquals=false;
	DBG_LOCAL(t_hasEquals,"hasEquals")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<324>");
	bool t_hasSepcial=false;
	DBG_LOCAL(t_hasSepcial,"hasSepcial")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<326>");
	String t_itemId=String();
	DBG_LOCAL(t_itemId,"itemId")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<327>");
	String t_itemValue=String();
	DBG_LOCAL(t_itemValue,"itemValue")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<329>");
	for(t_queryIndex=0;t_queryIndex<t_query.Length();t_queryIndex=t_queryIndex+1){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<331>");
		t_queryAsc=(int)t_query.At(t_queryIndex);
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<333>");
		if(t_isEscaped){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<335>");
			t_isEscaped=false;
			DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<336>");
			t_buffer->p_Add4(t_queryAsc);
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<339>");
			int t_1=t_queryAsc;
			DBG_LOCAL(t_1,"1")
			DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<340>");
			if(t_1==38){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<341>");
				t_processBuffer=true;
				DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<342>");
				t_processItem=true;
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<344>");
				if(t_1==61){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<345>");
					t_processBuffer=true;
					DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<346>");
					t_hasEquals=true;
				}else{
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<348>");
					if(t_1==64){
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<349>");
						if(t_hasId==false){
							DBG_BLOCK();
							DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<351>");
							if(t_buffer->p_Length2()==0){
								DBG_BLOCK();
								t_hasSepcial=true;
							}
						}else{
							DBG_BLOCK();
							DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<354>");
							t_buffer->p_Add4(t_queryAsc);
						}
					}else{
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<357>");
						if(t_1==92){
							DBG_BLOCK();
							DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<358>");
							t_isEscaped=true;
						}else{
							DBG_BLOCK();
							DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<362>");
							if(t_hasId || (t_queryAsc==45 || t_queryAsc==95 || t_queryAsc>=48 && t_queryAsc<=57 || t_queryAsc>=65 && t_queryAsc<=90 || t_queryAsc>=97 && t_queryAsc<=122)){
								DBG_BLOCK();
								t_buffer->p_Add4(t_queryAsc);
							}
						}
					}
				}
			}
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<367>");
		if(t_queryIndex==t_query.Length()-1){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<368>");
			t_processBuffer=true;
			DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<369>");
			t_processItem=true;
			DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<372>");
			if(t_isEscaped && t_hasId){
				DBG_BLOCK();
				t_buffer->p_Add4(92);
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<375>");
			if(t_hasEquals && t_buffer->p_Length2()==0){
				DBG_BLOCK();
				t_hasValue=true;
			}
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<379>");
		if(t_processBuffer){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<381>");
			t_processBuffer=false;
			DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<384>");
			if(t_hasId==false){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<385>");
				t_itemId=t_buffer->p_value();
				DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<386>");
				t_buffer->p_Clear();
				DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<387>");
				t_hasId=t_itemId.Length()>0;
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<389>");
				t_itemValue=t_buffer->p_value();
				DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<390>");
				t_buffer->p_Clear();
				DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<391>");
				t_hasValue=true;
			}
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<396>");
		if(t_processItem){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<398>");
			t_processItem=false;
			DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<401>");
			if(t_hasId){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<404>");
				if(m_count==m_items.Length()){
					DBG_BLOCK();
					gc_assign(m_items,m_items.Resize(m_items.Length()+m_chunk));
				}
				DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<407>");
				gc_assign(m_items.At(m_count),(new c_XMLAttributeQueryItem)->m_new(t_itemId,t_itemValue,t_hasValue,t_hasSepcial));
				DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<410>");
				m_count+=1;
				DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<413>");
				t_itemId=String();
				DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<414>");
				t_itemValue=String();
				DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<415>");
				t_hasId=false;
				DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<416>");
				t_hasValue=false;
				DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<417>");
				t_hasSepcial=false;
			}
		}
	}
	return this;
}
c_XMLAttributeQuery* c_XMLAttributeQuery::m_new2(){
	DBG_ENTER("XMLAttributeQuery.new")
	c_XMLAttributeQuery *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<300>");
	return this;
}
int c_XMLAttributeQuery::p_Length2(){
	DBG_ENTER("XMLAttributeQuery.Length")
	c_XMLAttributeQuery *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<451>");
	return m_count;
}
bool c_XMLAttributeQuery::p_Test(c_XMLNode* t_node){
	DBG_ENTER("XMLAttributeQuery.Test")
	c_XMLAttributeQuery *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_node,"node")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<426>");
	c_XMLAttribute* t_attribute=0;
	DBG_LOCAL(t_attribute,"attribute")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<428>");
	for(int t_index=0;t_index<m_count;t_index=t_index+1){
		DBG_BLOCK();
		DBG_LOCAL(t_index,"index")
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<429>");
		if(m_items.At(t_index)->m_special==false){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<432>");
			t_attribute=t_node->p_GetXMLAttribute(m_items.At(t_index)->m_id);
			DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<435>");
			if(t_attribute==0 || m_items.At(t_index)->m_required && t_attribute->m_value!=m_items.At(t_index)->m_value){
				DBG_BLOCK();
				return false;
			}
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<438>");
			String t_2=m_items.At(t_index)->m_id;
			DBG_LOCAL(t_2,"2")
			DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<439>");
			if(t_2==String(L"value",5)){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<441>");
				if(m_items.At(t_index)->m_required && t_node->m_value!=m_items.At(t_index)->m_value){
					DBG_BLOCK();
					return false;
				}
			}
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<447>");
	return true;
}
void c_XMLAttributeQuery::mark(){
	Object::mark();
	gc_mark_q(m_items);
}
String c_XMLAttributeQuery::debug(){
	String t="(XMLAttributeQuery)\n";
	t+=dbg_decl("chunk",&m_chunk);
	t+=dbg_decl("items",&m_items);
	t+=dbg_decl("count",&m_count);
	return t;
}
c_XMLAttributeQueryItem::c_XMLAttributeQueryItem(){
	m_id=String();
	m_value=String();
	m_required=false;
	m_special=false;
}
c_XMLAttributeQueryItem* c_XMLAttributeQueryItem::m_new(String t_id,String t_value,bool t_required,bool t_special){
	DBG_ENTER("XMLAttributeQueryItem.new")
	c_XMLAttributeQueryItem *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_id,"id")
	DBG_LOCAL(t_value,"value")
	DBG_LOCAL(t_required,"required")
	DBG_LOCAL(t_special,"special")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<463>");
	this->m_id=t_id;
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<464>");
	this->m_value=t_value;
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<465>");
	this->m_required=t_required;
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<466>");
	this->m_special=t_special;
	return this;
}
c_XMLAttributeQueryItem* c_XMLAttributeQueryItem::m_new2(){
	DBG_ENTER("XMLAttributeQueryItem.new")
	c_XMLAttributeQueryItem *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<455>");
	return this;
}
void c_XMLAttributeQueryItem::mark(){
	Object::mark();
}
String c_XMLAttributeQueryItem::debug(){
	String t="(XMLAttributeQueryItem)\n";
	t+=dbg_decl("id",&m_id);
	t+=dbg_decl("value",&m_value);
	t+=dbg_decl("required",&m_required);
	t+=dbg_decl("special",&m_special);
	return t;
}
c_XMLAttribute::c_XMLAttribute(){
	m_id=String();
	m_value=String();
}
c_XMLAttribute* c_XMLAttribute::m_new(String t_id,String t_value){
	DBG_ENTER("XMLAttribute.new")
	c_XMLAttribute *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_id,"id")
	DBG_LOCAL(t_value,"value")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1776>");
	this->m_id=t_id;
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1777>");
	this->m_value=t_value;
	return this;
}
c_XMLAttribute* c_XMLAttribute::m_new2(){
	DBG_ENTER("XMLAttribute.new")
	c_XMLAttribute *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1770>");
	return this;
}
void c_XMLAttribute::mark(){
	Object::mark();
}
String c_XMLAttribute::debug(){
	String t="(XMLAttribute)\n";
	t+=dbg_decl("id",&m_id);
	t+=dbg_decl("value",&m_value);
	return t;
}
c_Map7::c_Map7(){
	m_root=0;
}
c_Map7* c_Map7::m_new(){
	DBG_ENTER("Map.new")
	c_Map7 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<7>");
	return this;
}
c_Node18* c_Map7::p_FindNode2(String t_key){
	DBG_ENTER("Map.FindNode")
	c_Map7 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_key,"key")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<157>");
	c_Node18* t_node=m_root;
	DBG_LOCAL(t_node,"node")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<159>");
	while((t_node)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<160>");
		int t_cmp=p_Compare3(t_key,t_node->m_key);
		DBG_LOCAL(t_cmp,"cmp")
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<161>");
		if(t_cmp>0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<162>");
			t_node=t_node->m_right;
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<163>");
			if(t_cmp<0){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<164>");
				t_node=t_node->m_left;
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<166>");
				return t_node;
			}
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<169>");
	return t_node;
}
c_XMLAttribute* c_Map7::p_Get2(String t_key){
	DBG_ENTER("Map.Get")
	c_Map7 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_key,"key")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<101>");
	c_Node18* t_node=p_FindNode2(t_key);
	DBG_LOCAL(t_node,"node")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<102>");
	if((t_node)!=0){
		DBG_BLOCK();
		return t_node->m_value;
	}
	return 0;
}
int c_Map7::p_RotateLeft5(c_Node18* t_node){
	DBG_ENTER("Map.RotateLeft")
	c_Map7 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_node,"node")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<251>");
	c_Node18* t_child=t_node->m_right;
	DBG_LOCAL(t_child,"child")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<252>");
	gc_assign(t_node->m_right,t_child->m_left);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<253>");
	if((t_child->m_left)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<254>");
		gc_assign(t_child->m_left->m_parent,t_node);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<256>");
	gc_assign(t_child->m_parent,t_node->m_parent);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<257>");
	if((t_node->m_parent)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<258>");
		if(t_node==t_node->m_parent->m_left){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<259>");
			gc_assign(t_node->m_parent->m_left,t_child);
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<261>");
			gc_assign(t_node->m_parent->m_right,t_child);
		}
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<264>");
		gc_assign(m_root,t_child);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<266>");
	gc_assign(t_child->m_left,t_node);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<267>");
	gc_assign(t_node->m_parent,t_child);
	return 0;
}
int c_Map7::p_RotateRight5(c_Node18* t_node){
	DBG_ENTER("Map.RotateRight")
	c_Map7 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_node,"node")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<271>");
	c_Node18* t_child=t_node->m_left;
	DBG_LOCAL(t_child,"child")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<272>");
	gc_assign(t_node->m_left,t_child->m_right);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<273>");
	if((t_child->m_right)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<274>");
		gc_assign(t_child->m_right->m_parent,t_node);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<276>");
	gc_assign(t_child->m_parent,t_node->m_parent);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<277>");
	if((t_node->m_parent)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<278>");
		if(t_node==t_node->m_parent->m_right){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<279>");
			gc_assign(t_node->m_parent->m_right,t_child);
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<281>");
			gc_assign(t_node->m_parent->m_left,t_child);
		}
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<284>");
		gc_assign(m_root,t_child);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<286>");
	gc_assign(t_child->m_right,t_node);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<287>");
	gc_assign(t_node->m_parent,t_child);
	return 0;
}
int c_Map7::p_InsertFixup5(c_Node18* t_node){
	DBG_ENTER("Map.InsertFixup")
	c_Map7 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_node,"node")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<212>");
	while(((t_node->m_parent)!=0) && t_node->m_parent->m_color==-1 && ((t_node->m_parent->m_parent)!=0)){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<213>");
		if(t_node->m_parent==t_node->m_parent->m_parent->m_left){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<214>");
			c_Node18* t_uncle=t_node->m_parent->m_parent->m_right;
			DBG_LOCAL(t_uncle,"uncle")
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<215>");
			if(((t_uncle)!=0) && t_uncle->m_color==-1){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<216>");
				t_node->m_parent->m_color=1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<217>");
				t_uncle->m_color=1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<218>");
				t_uncle->m_parent->m_color=-1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<219>");
				t_node=t_uncle->m_parent;
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<221>");
				if(t_node==t_node->m_parent->m_right){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<222>");
					t_node=t_node->m_parent;
					DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<223>");
					p_RotateLeft5(t_node);
				}
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<225>");
				t_node->m_parent->m_color=1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<226>");
				t_node->m_parent->m_parent->m_color=-1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<227>");
				p_RotateRight5(t_node->m_parent->m_parent);
			}
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<230>");
			c_Node18* t_uncle2=t_node->m_parent->m_parent->m_left;
			DBG_LOCAL(t_uncle2,"uncle")
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<231>");
			if(((t_uncle2)!=0) && t_uncle2->m_color==-1){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<232>");
				t_node->m_parent->m_color=1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<233>");
				t_uncle2->m_color=1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<234>");
				t_uncle2->m_parent->m_color=-1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<235>");
				t_node=t_uncle2->m_parent;
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<237>");
				if(t_node==t_node->m_parent->m_left){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<238>");
					t_node=t_node->m_parent;
					DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<239>");
					p_RotateRight5(t_node);
				}
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<241>");
				t_node->m_parent->m_color=1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<242>");
				t_node->m_parent->m_parent->m_color=-1;
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<243>");
				p_RotateLeft5(t_node->m_parent->m_parent);
			}
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<247>");
	m_root->m_color=1;
	return 0;
}
bool c_Map7::p_Set6(String t_key,c_XMLAttribute* t_value){
	DBG_ENTER("Map.Set")
	c_Map7 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_key,"key")
	DBG_LOCAL(t_value,"value")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<29>");
	c_Node18* t_node=m_root;
	DBG_LOCAL(t_node,"node")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<30>");
	c_Node18* t_parent=0;
	int t_cmp=0;
	DBG_LOCAL(t_parent,"parent")
	DBG_LOCAL(t_cmp,"cmp")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<32>");
	while((t_node)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<33>");
		t_parent=t_node;
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<34>");
		t_cmp=p_Compare3(t_key,t_node->m_key);
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<35>");
		if(t_cmp>0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<36>");
			t_node=t_node->m_right;
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<37>");
			if(t_cmp<0){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<38>");
				t_node=t_node->m_left;
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<40>");
				gc_assign(t_node->m_value,t_value);
				DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<41>");
				return false;
			}
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<45>");
	t_node=(new c_Node18)->m_new(t_key,t_value,-1,t_parent);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<47>");
	if((t_parent)!=0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<48>");
		if(t_cmp>0){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<49>");
			gc_assign(t_parent->m_right,t_node);
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<51>");
			gc_assign(t_parent->m_left,t_node);
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<53>");
		p_InsertFixup5(t_node);
	}else{
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<55>");
		gc_assign(m_root,t_node);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<57>");
	return true;
}
bool c_Map7::p_Insert4(String t_key,c_XMLAttribute* t_value){
	DBG_ENTER("Map.Insert")
	c_Map7 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_key,"key")
	DBG_LOCAL(t_value,"value")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<126>");
	bool t_=p_Set6(t_key,t_value);
	return t_;
}
void c_Map7::mark(){
	Object::mark();
	gc_mark_q(m_root);
}
String c_Map7::debug(){
	String t="(Map)\n";
	t+=dbg_decl("root",&m_root);
	return t;
}
c_StringMap3::c_StringMap3(){
}
c_StringMap3* c_StringMap3::m_new(){
	DBG_ENTER("StringMap.new")
	c_StringMap3 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<551>");
	c_Map7::m_new();
	return this;
}
int c_StringMap3::p_Compare3(String t_lhs,String t_rhs){
	DBG_ENTER("StringMap.Compare")
	c_StringMap3 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_lhs,"lhs")
	DBG_LOCAL(t_rhs,"rhs")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<554>");
	int t_=t_lhs.Compare(t_rhs);
	return t_;
}
void c_StringMap3::mark(){
	c_Map7::mark();
}
String c_StringMap3::debug(){
	String t="(StringMap)\n";
	t=c_Map7::debug()+t;
	return t;
}
c_Node18::c_Node18(){
	m_key=String();
	m_right=0;
	m_left=0;
	m_value=0;
	m_color=0;
	m_parent=0;
}
c_Node18* c_Node18::m_new(String t_key,c_XMLAttribute* t_value,int t_color,c_Node18* t_parent){
	DBG_ENTER("Node.new")
	c_Node18 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_key,"key")
	DBG_LOCAL(t_value,"value")
	DBG_LOCAL(t_color,"color")
	DBG_LOCAL(t_parent,"parent")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<364>");
	this->m_key=t_key;
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<365>");
	gc_assign(this->m_value,t_value);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<366>");
	this->m_color=t_color;
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<367>");
	gc_assign(this->m_parent,t_parent);
	return this;
}
c_Node18* c_Node18::m_new2(){
	DBG_ENTER("Node.new")
	c_Node18 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/map.monkey<361>");
	return this;
}
void c_Node18::mark(){
	Object::mark();
	gc_mark_q(m_right);
	gc_mark_q(m_left);
	gc_mark_q(m_value);
	gc_mark_q(m_parent);
}
String c_Node18::debug(){
	String t="(Node)\n";
	t+=dbg_decl("key",&m_key);
	t+=dbg_decl("value",&m_value);
	t+=dbg_decl("color",&m_color);
	t+=dbg_decl("parent",&m_parent);
	t+=dbg_decl("left",&m_left);
	t+=dbg_decl("right",&m_right);
	return t;
}
c_XMLDoc* bb_xml_ParseXML(String t_raw,c_XMLError* t_error,int t_options){
	DBG_ENTER("ParseXML")
	DBG_LOCAL(t_raw,"raw")
	DBG_LOCAL(t_error,"error")
	DBG_LOCAL(t_options,"options")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1851>");
	int t_rawLine=1;
	DBG_LOCAL(t_rawLine,"rawLine")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1852>");
	int t_rawColumn=1;
	DBG_LOCAL(t_rawColumn,"rawColumn")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1853>");
	int t_rawIndex=0;
	DBG_LOCAL(t_rawIndex,"rawIndex")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1854>");
	int t_rawAsc=0;
	DBG_LOCAL(t_rawAsc,"rawAsc")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1855>");
	int t_rawPos=0;
	DBG_LOCAL(t_rawPos,"rawPos")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1856>");
	int t_rawChunkStart=0;
	DBG_LOCAL(t_rawChunkStart,"rawChunkStart")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1857>");
	int t_rawChunkLength=0;
	DBG_LOCAL(t_rawChunkLength,"rawChunkLength")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1858>");
	int t_rawChunkEnd=0;
	DBG_LOCAL(t_rawChunkEnd,"rawChunkEnd")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1859>");
	String t_rawChunk=String();
	DBG_LOCAL(t_rawChunk,"rawChunk")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1860>");
	int t_rawChunkIndex=0;
	DBG_LOCAL(t_rawChunkIndex,"rawChunkIndex")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1861>");
	int t_rawChunkAsc=0;
	DBG_LOCAL(t_rawChunkAsc,"rawChunkAsc")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1862>");
	bool t_rawChunkExit=false;
	DBG_LOCAL(t_rawChunkExit,"rawChunkExit")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1864>");
	c_XMLDoc* t_doc=0;
	DBG_LOCAL(t_doc,"doc")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1865>");
	c_XMLNode* t_parent=0;
	DBG_LOCAL(t_parent,"parent")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1866>");
	c_XMLNode* t_current=0;
	DBG_LOCAL(t_current,"current")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1867>");
	c_XMLNode* t_textNode=0;
	DBG_LOCAL(t_textNode,"textNode")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1869>");
	c_XMLStringBuffer* t_whitespaceBuffer=(new c_XMLStringBuffer)->m_new(1024);
	DBG_LOCAL(t_whitespaceBuffer,"whitespaceBuffer")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1870>");
	c_XMLStringBuffer* t_attributeBuffer=(new c_XMLStringBuffer)->m_new(1024);
	DBG_LOCAL(t_attributeBuffer,"attributeBuffer")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1872>");
	bool t_processAttributeBuffer=false;
	DBG_LOCAL(t_processAttributeBuffer,"processAttributeBuffer")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1873>");
	bool t_processTag=false;
	DBG_LOCAL(t_processTag,"processTag")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1875>");
	String t_tagName=String();
	DBG_LOCAL(t_tagName,"tagName")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1877>");
	String t_formatVersion=String();
	DBG_LOCAL(t_formatVersion,"formatVersion")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1878>");
	String t_formatEncoding=String();
	DBG_LOCAL(t_formatEncoding,"formatEncoding")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1880>");
	String t_attributeId=String();
	DBG_LOCAL(t_attributeId,"attributeId")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1881>");
	String t_attributeValue=String();
	DBG_LOCAL(t_attributeValue,"attributeValue")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1883>");
	bool t_inTag=false;
	DBG_LOCAL(t_inTag,"inTag")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1884>");
	bool t_inQuote=false;
	DBG_LOCAL(t_inQuote,"inQuote")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1885>");
	bool t_inFormat=false;
	DBG_LOCAL(t_inFormat,"inFormat")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1887>");
	bool t_isCloseSelf=false;
	DBG_LOCAL(t_isCloseSelf,"isCloseSelf")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1888>");
	bool t_isSingleAttribute=false;
	DBG_LOCAL(t_isSingleAttribute,"isSingleAttribute")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1890>");
	bool t_hasFormat=false;
	DBG_LOCAL(t_hasFormat,"hasFormat")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1891>");
	bool t_hasTagName=false;
	DBG_LOCAL(t_hasTagName,"hasTagName")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1892>");
	bool t_hasTagClose=false;
	DBG_LOCAL(t_hasTagClose,"hasTagClose")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1893>");
	bool t_hasAttributeId=false;
	DBG_LOCAL(t_hasAttributeId,"hasAttributeId")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1894>");
	bool t_hasAttributeValue=false;
	DBG_LOCAL(t_hasAttributeValue,"hasAttributeValue")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1895>");
	bool t_hasEquals=false;
	DBG_LOCAL(t_hasEquals,"hasEquals")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1897>");
	bool t_waitTagClose=false;
	DBG_LOCAL(t_waitTagClose,"waitTagClose")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1899>");
	c_List13* t_stack=(new c_List13)->m_new();
	DBG_LOCAL(t_stack,"stack")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1901>");
	int t_quoteAsc=0;
	DBG_LOCAL(t_quoteAsc,"quoteAsc")
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1904>");
	if((t_error)!=0){
		DBG_BLOCK();
		t_error->p_Reset();
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1907>");
	if(t_raw.Length()==0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1909>");
		if((t_error)!=0){
			DBG_BLOCK();
			t_error->p_Set4(String(L"no xml data",11),-1,-1,-1);
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1910>");
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1914>");
	for(t_rawIndex=0;t_rawIndex<t_raw.Length();t_rawIndex=t_rawIndex+1){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1915>");
		t_rawAsc=(int)t_raw.At(t_rawIndex);
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1917>");
		if(t_inTag==false){
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1918>");
			int t_3=t_rawAsc;
			DBG_LOCAL(t_3,"3")
			DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1919>");
			if(t_3==9 || t_3==32){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1920>");
				if(((t_whitespaceBuffer->p_Length2())!=0) || ((t_parent)!=0) && ((t_parent->m_value.Length())!=0)){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1922>");
					int t_lastAsc=t_whitespaceBuffer->p_Last(-1);
					DBG_LOCAL(t_lastAsc,"lastAsc")
					DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1923>");
					if((t_options&1)==0 || ((t_whitespaceBuffer->p_Length2())!=0) && t_lastAsc!=9 && t_lastAsc!=32){
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1925>");
						if(t_parent==0){
							DBG_BLOCK();
							DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1927>");
							if((t_error)!=0){
								DBG_BLOCK();
								t_error->p_Set4(String(L"illegal character",17),t_rawLine,t_rawColumn,t_rawIndex);
							}
							DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1928>");
							return 0;
						}
						DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1932>");
						t_whitespaceBuffer->p_Add4(t_rawAsc);
					}
				}
				DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1937>");
				t_rawColumn+=1;
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1939>");
				if(t_3==10){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1941>");
					t_rawLine+=1;
					DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1942>");
					t_rawColumn=1;
					DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1945>");
					if((t_options&2)==0){
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1946>");
						t_whitespaceBuffer->p_Add4(t_rawAsc);
					}
				}else{
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1949>");
					if(t_3==13){
						DBG_BLOCK();
					}else{
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1952>");
						if(t_3==60){
							DBG_BLOCK();
							DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1956>");
							if(((t_parent)!=0) && ((t_whitespaceBuffer->p_Length2())!=0)){
								DBG_BLOCK();
								DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1958>");
								if((t_options&1)==1){
									DBG_BLOCK();
									DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1959>");
									t_whitespaceBuffer->p_Trim();
								}
								DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1963>");
								if((t_whitespaceBuffer->p_Length2())!=0){
									DBG_BLOCK();
									DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1964>");
									t_textNode=t_parent->p_AddText(t_whitespaceBuffer->p_value());
									DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1965>");
									t_whitespaceBuffer->p_Clear();
								}
							}
							DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1970>");
							if(bb_xml_XMLHasStringAtOffset(String(L"<?xml",5),t_raw,t_rawIndex)){
								DBG_BLOCK();
								DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1973>");
								if(t_hasFormat){
									DBG_BLOCK();
									DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1975>");
									if((t_error)!=0){
										DBG_BLOCK();
										t_error->p_Set4(String(L"duplicate xml format",20),t_rawLine,t_rawColumn,t_rawIndex);
									}
									DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1976>");
									return 0;
								}
								DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1980>");
								if(t_doc!=0){
									DBG_BLOCK();
									DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1982>");
									if((t_error)!=0){
										DBG_BLOCK();
										t_error->p_Set4(String(L"doc format should be defined before root node",45),t_rawLine,t_rawColumn,t_rawIndex);
									}
									DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1983>");
									return 0;
								}
								DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1987>");
								t_inTag=true;
								DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1988>");
								t_inFormat=true;
								DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1991>");
								t_rawColumn+=String(L"<?xml",5).Length();
								DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1994>");
								t_rawIndex=t_rawPos+String(L"<?xml",5).Length()-1;
							}else{
								DBG_BLOCK();
								DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1996>");
								if(bb_xml_XMLHasStringAtOffset(String(L"<!DOCTYPE",9),t_raw,t_rawIndex)){
									DBG_BLOCK();
									DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<1999>");
									t_rawPos=bb_xml_XMLFindStringNotInQuotes(String(L">",1),t_raw,t_rawIndex+String(L"<!DOCTYPE",9).Length());
									DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2001>");
									if(t_rawPos==-1){
										DBG_BLOCK();
										DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2003>");
										if((t_error)!=0){
											DBG_BLOCK();
											t_error->p_Set4(String(L"doctype not closed",18),t_rawLine,t_rawColumn,t_rawIndex);
										}
										DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2004>");
										return 0;
									}
									DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2008>");
									t_rawChunkStart=t_rawIndex+String(L"<!DOCTYPE",9).Length();
									DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2009>");
									t_rawChunkLength=t_rawPos-(t_rawIndex+String(L"<!DOCTYPE",9).Length());
									DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2010>");
									t_rawChunkEnd=t_rawChunkStart+t_rawChunkLength;
									DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2013>");
									for(t_rawChunkIndex=t_rawChunkStart;t_rawChunkIndex<t_rawChunkEnd;t_rawChunkIndex=t_rawChunkIndex+1){
										DBG_BLOCK();
										DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2014>");
										t_rawChunkAsc=(int)t_raw.At(t_rawChunkIndex);
										DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2015>");
										if(t_rawChunkAsc==10){
											DBG_BLOCK();
											DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2016>");
											t_rawLine+=1;
											DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2017>");
											t_rawColumn=1;
										}else{
											DBG_BLOCK();
											DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2019>");
											t_rawColumn+=1;
										}
									}
									DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2024>");
									t_rawIndex=t_rawPos+String(L">",1).Length()-1;
								}else{
									DBG_BLOCK();
									DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2026>");
									if(bb_xml_XMLHasStringAtOffset(String(L"<!--",4),t_raw,t_rawIndex)){
										DBG_BLOCK();
										DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2029>");
										t_rawPos=t_raw.Find(String(L"-->",3),t_rawIndex+String(L"<!--",4).Length());
										DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2030>");
										if(t_rawPos==-1){
											DBG_BLOCK();
											DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2032>");
											if((t_error)!=0){
												DBG_BLOCK();
												t_error->p_Set4(String(L"comment not closed",18),t_rawLine,t_rawColumn,t_rawIndex);
											}
											DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2033>");
											return 0;
										}
										DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2037>");
										t_rawChunkStart=t_rawIndex+String(L"<!--",4).Length();
										DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2038>");
										t_rawChunkLength=t_rawPos-(t_rawIndex+String(L"<!--",4).Length());
										DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2039>");
										t_rawChunkEnd=t_rawChunkStart+t_rawChunkLength;
										DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2042>");
										for(t_rawChunkIndex=t_rawChunkStart;t_rawChunkIndex<t_rawChunkEnd;t_rawChunkIndex=t_rawChunkIndex+1){
											DBG_BLOCK();
											DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2043>");
											t_rawChunkAsc=(int)t_raw.At(t_rawChunkIndex);
											DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2044>");
											if(t_rawChunkAsc==10){
												DBG_BLOCK();
												DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2045>");
												t_rawLine+=1;
												DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2046>");
												t_rawColumn=1;
											}else{
												DBG_BLOCK();
												DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2048>");
												t_rawColumn+=1;
											}
										}
										DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2053>");
										t_rawIndex=t_rawPos+String(L"-->",3).Length()-1;
									}else{
										DBG_BLOCK();
										DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2055>");
										if(bb_xml_XMLHasStringAtOffset(String(L"<![CDATA[",9),t_raw,t_rawIndex)){
											DBG_BLOCK();
											DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2058>");
											t_rawPos=t_raw.Find(String(L"]]>",3),t_rawIndex+String(L"<![CDATA[",9).Length());
											DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2059>");
											if(t_rawPos==-1){
												DBG_BLOCK();
												DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2061>");
												if((t_error)!=0){
													DBG_BLOCK();
													t_error->p_Set4(String(L"cdata not closed",16),t_rawLine,t_rawColumn,t_rawIndex);
												}
												DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2062>");
												return 0;
											}
											DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2066>");
											if(t_parent==0){
												DBG_BLOCK();
												DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2068>");
												if((t_error)!=0){
													DBG_BLOCK();
													t_error->p_Set4(String(L"unexepcted cdata",16),t_rawLine,t_rawColumn,t_rawIndex);
												}
												DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2069>");
												return 0;
											}
											DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2073>");
											t_rawChunkStart=t_rawIndex+String(L"<![CDATA[",9).Length();
											DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2074>");
											t_rawChunkLength=t_rawPos-(t_rawIndex+String(L"<![CDATA[",9).Length());
											DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2075>");
											t_rawChunkEnd=t_rawChunkStart+t_rawChunkLength;
											DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2078>");
											for(t_rawChunkIndex=t_rawChunkStart;t_rawChunkIndex<t_rawChunkEnd;t_rawChunkIndex=t_rawChunkIndex+1){
												DBG_BLOCK();
												DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2079>");
												t_rawChunkAsc=(int)t_raw.At(t_rawChunkIndex);
												DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2080>");
												if(t_rawChunkAsc==10){
													DBG_BLOCK();
													DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2081>");
													t_rawLine+=1;
													DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2082>");
													t_rawColumn=1;
												}else{
													DBG_BLOCK();
													DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2084>");
													t_rawColumn+=1;
												}
											}
											DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2089>");
											t_whitespaceBuffer->p_Add6(t_raw,t_rawChunkStart,t_rawChunkLength);
											DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2092>");
											if(((t_parent)!=0) && ((t_whitespaceBuffer->p_Length2())!=0)){
												DBG_BLOCK();
												DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2093>");
												t_textNode=t_parent->p_AddText(t_whitespaceBuffer->p_value());
												DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2094>");
												t_whitespaceBuffer->p_Clear();
											}
											DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2098>");
											t_rawIndex=t_rawPos+String(L"]]>",3).Length()-1;
										}else{
											DBG_BLOCK();
											DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2102>");
											t_inTag=true;
											DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2105>");
											if((t_whitespaceBuffer->p_Length2())!=0){
												DBG_BLOCK();
												DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2107>");
												if((t_options&1)==1){
													DBG_BLOCK();
													DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2108>");
													t_whitespaceBuffer->p_Trim();
												}
												DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2112>");
												if((t_whitespaceBuffer->p_Length2())!=0){
													DBG_BLOCK();
													DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2114>");
													if((t_options&1)==1){
														DBG_BLOCK();
														DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2115>");
														t_whitespaceBuffer->p_Trim();
													}
													DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2119>");
													if((t_whitespaceBuffer->p_Length2())!=0){
														DBG_BLOCK();
														DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2120>");
														t_textNode=t_parent->p_AddText(t_whitespaceBuffer->p_value());
														DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2121>");
														t_whitespaceBuffer->p_Clear();
													}
												}
											}
											DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2127>");
											t_rawColumn+=1;
										}
									}
								}
							}
						}else{
							DBG_BLOCK();
							DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2130>");
							if(t_3==62){
								DBG_BLOCK();
								DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2132>");
								if((t_error)!=0){
									DBG_BLOCK();
									t_error->p_Set4(String(L"unexpected close bracket",24),t_rawLine,t_rawColumn,t_rawIndex);
								}
								DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2133>");
								return 0;
							}else{
								DBG_BLOCK();
								DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2137>");
								if(t_parent==0){
									DBG_BLOCK();
									DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2139>");
									if((t_error)!=0){
										DBG_BLOCK();
										t_error->p_Set4(String(L"illegal character",17),t_rawLine,t_rawColumn,t_rawIndex);
									}
									DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2140>");
									return 0;
								}
								DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2144>");
								t_whitespaceBuffer->p_Add4(t_rawAsc);
								DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2147>");
								t_rawColumn+=1;
							}
						}
					}
				}
			}
		}else{
			DBG_BLOCK();
			DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2151>");
			if(t_waitTagClose){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2153>");
				int t_4=t_rawAsc;
				DBG_LOCAL(t_4,"4")
				DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2154>");
				if(t_4==9){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2156>");
					t_rawColumn+=1;
				}else{
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2157>");
					if(t_4==10){
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2159>");
						t_rawLine+=1;
						DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2160>");
						t_rawColumn=1;
					}else{
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2162>");
						if(t_4==13){
							DBG_BLOCK();
						}else{
							DBG_BLOCK();
							DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2165>");
							if(t_4==32){
								DBG_BLOCK();
								DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2167>");
								t_rawColumn+=1;
							}else{
								DBG_BLOCK();
								DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2169>");
								if(t_4==62){
									DBG_BLOCK();
									DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2171>");
									t_waitTagClose=false;
									DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2172>");
									t_processTag=true;
								}else{
									DBG_BLOCK();
									DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2176>");
									if((t_error)!=0){
										DBG_BLOCK();
										t_error->p_Set4(String(L"unexpected character",20),t_rawLine,t_rawColumn,t_rawIndex);
									}
									DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2177>");
									return 0;
								}
							}
						}
					}
				}
			}else{
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2180>");
				if(t_inQuote==false){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2182>");
					int t_5=t_rawAsc;
					DBG_LOCAL(t_5,"5")
					DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2183>");
					if(t_5==9){
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2185>");
						t_rawColumn+=1;
						DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2188>");
						if((t_attributeBuffer->p_Length2())!=0){
							DBG_BLOCK();
							t_processAttributeBuffer=true;
						}
					}else{
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2190>");
						if(t_5==10){
							DBG_BLOCK();
							DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2193>");
							t_rawLine+=1;
							DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2194>");
							t_rawColumn=1;
							DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2197>");
							if((t_attributeBuffer->p_Length2())!=0){
								DBG_BLOCK();
								t_processAttributeBuffer=true;
							}
						}else{
							DBG_BLOCK();
							DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2199>");
							if(t_5==13){
								DBG_BLOCK();
							}else{
								DBG_BLOCK();
								DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2202>");
								if(t_5==32){
									DBG_BLOCK();
									DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2204>");
									t_rawColumn+=1;
									DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2207>");
									if((t_attributeBuffer->p_Length2())!=0){
										DBG_BLOCK();
										t_processAttributeBuffer=true;
									}
								}else{
									DBG_BLOCK();
									DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2209>");
									if(t_5==34 || t_5==39){
										DBG_BLOCK();
										DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2211>");
										t_quoteAsc=t_rawAsc;
										DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2212>");
										t_inQuote=true;
										DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2215>");
										if(t_hasTagClose || t_hasTagName==false && t_inFormat==false || t_hasEquals==false || ((t_attributeBuffer->p_Length2())!=0)){
											DBG_BLOCK();
											DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2217>");
											if((t_error)!=0){
												DBG_BLOCK();
												t_error->p_Set4(String(L"unexpected quote",16),t_rawLine,t_rawColumn,t_rawIndex);
											}
											DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2218>");
											return 0;
										}
										DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2222>");
										t_rawColumn+=1;
										DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2225>");
										if((t_attributeBuffer->p_Length2())!=0){
											DBG_BLOCK();
											t_processAttributeBuffer=true;
										}
									}else{
										DBG_BLOCK();
										DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2227>");
										if(t_5==47){
											DBG_BLOCK();
											DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2229>");
											if(t_hasTagClose || t_hasEquals){
												DBG_BLOCK();
												DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2231>");
												if((t_error)!=0){
													DBG_BLOCK();
													t_error->p_Set4(String(L"unexpected slash",16),t_rawLine,t_rawColumn,t_rawIndex);
												}
												DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2232>");
												return 0;
											}
											DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2236>");
											if((t_attributeBuffer->p_Length2())!=0){
												DBG_BLOCK();
												t_processAttributeBuffer=true;
											}
											DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2239>");
											if(t_hasTagName==false){
												DBG_BLOCK();
												DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2241>");
												if(t_processAttributeBuffer){
													DBG_BLOCK();
													DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2243>");
													t_isCloseSelf=true;
													DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2244>");
													t_waitTagClose=true;
												}else{
													DBG_BLOCK();
													DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2247>");
													t_hasTagClose=true;
												}
											}else{
												DBG_BLOCK();
												DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2251>");
												t_hasTagClose=true;
												DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2252>");
												t_isCloseSelf=true;
												DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2253>");
												t_waitTagClose=true;
											}
											DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2257>");
											t_rawColumn+=1;
										}else{
											DBG_BLOCK();
											DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2259>");
											if(t_5==61){
												DBG_BLOCK();
												DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2262>");
												t_rawColumn+=1;
												DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2264>");
												if(t_hasTagClose || t_hasTagName==false && t_inFormat==false || t_hasEquals || t_hasAttributeId || t_attributeBuffer->p_Length2()==0){
													DBG_BLOCK();
													DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2266>");
													if((t_error)!=0){
														DBG_BLOCK();
														t_error->p_Set4(String(L"unexpected equals",17),t_rawLine,t_rawColumn,t_rawIndex);
													}
													DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2267>");
													return 0;
												}
												DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2271>");
												t_processAttributeBuffer=true;
												DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2272>");
												t_hasEquals=true;
											}else{
												DBG_BLOCK();
												DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2274>");
												if(t_5==62){
													DBG_BLOCK();
													DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2277>");
													if(t_hasEquals || t_hasTagName==false && t_attributeBuffer->p_Length2()==0){
														DBG_BLOCK();
														DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2279>");
														if((t_error)!=0){
															DBG_BLOCK();
															t_error->p_Set4(String(L"unexpected close bracket",24),t_rawLine,t_rawColumn,t_rawIndex);
														}
														DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2280>");
														return 0;
													}
													DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2284>");
													if((t_attributeBuffer->p_Length2())!=0){
														DBG_BLOCK();
														t_processAttributeBuffer=true;
													}
													DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2287>");
													t_processTag=true;
													DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2290>");
													t_rawColumn+=1;
												}else{
													DBG_BLOCK();
													DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2292>");
													if(t_5==63){
														DBG_BLOCK();
														DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2295>");
														if(t_inFormat==false || t_rawIndex==t_raw.Length()-1 || (int)t_raw.At(t_rawIndex+1)!=62){
															DBG_BLOCK();
															DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2297>");
															if((t_error)!=0){
																DBG_BLOCK();
																t_error->p_Set4(String(L"unexpected questionmark",23),t_rawLine,t_rawColumn,t_rawIndex);
															}
															DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2298>");
															return 0;
														}
														DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2302>");
														t_processTag=true;
														DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2305>");
														t_rawIndex+=1;
														DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2306>");
														t_rawColumn+=1;
													}else{
														DBG_BLOCK();
														DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2310>");
														if(t_rawAsc==45 || t_rawAsc==58 || t_rawAsc==95 || t_rawAsc>=48 && t_rawAsc<=57 || t_rawAsc>=65 && t_rawAsc<=90 || t_rawAsc>=97 && t_rawAsc<=122){
															DBG_BLOCK();
															DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2311>");
															if(t_hasTagClose==true && t_hasTagName==true){
																DBG_BLOCK();
																DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2313>");
																if((t_error)!=0){
																	DBG_BLOCK();
																	t_error->p_Set4(String(L"unexpected character",20),t_rawLine,t_rawColumn,t_rawIndex);
																}
																DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2314>");
																return 0;
															}
															DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2318>");
															if(t_hasAttributeId && t_hasEquals==false){
																DBG_BLOCK();
																DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2320>");
																t_isSingleAttribute=true;
																DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2321>");
																t_processAttributeBuffer=true;
															}else{
																DBG_BLOCK();
																DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2324>");
																t_attributeBuffer->p_Add4(t_rawAsc);
															}
															DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2328>");
															t_rawColumn+=1;
														}else{
															DBG_BLOCK();
															DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2331>");
															if((t_error)!=0){
																DBG_BLOCK();
																t_error->p_Set4(String(L"illegal character",17),t_rawLine,t_rawColumn,t_rawIndex);
															}
															DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2332>");
															return 0;
														}
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}else{
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2337>");
					if(t_rawAsc==t_quoteAsc){
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2339>");
						t_inQuote=false;
						DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2342>");
						t_processAttributeBuffer=true;
					}else{
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2345>");
						t_attributeBuffer->p_Add4(t_rawAsc);
					}
				}
				DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2350>");
				if(t_processAttributeBuffer){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2352>");
					t_processAttributeBuffer=false;
					DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2355>");
					if(t_hasTagName==false && t_inFormat==false){
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2357>");
						if(t_hasTagClose==false){
							DBG_BLOCK();
							DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2359>");
							t_tagName=t_attributeBuffer->p_value();
							DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2362>");
							if(t_parent==0){
								DBG_BLOCK();
								DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2363>");
								if(t_doc==0){
									DBG_BLOCK();
									DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2365>");
									t_doc=(new c_XMLDoc)->m_new(t_tagName,t_formatVersion,t_formatEncoding);
									DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2366>");
									gc_assign(t_doc->m_doc,t_doc);
									DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2367>");
									t_doc->m_parent=0;
									DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2368>");
									t_doc->m_line=t_rawLine;
									DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2369>");
									t_doc->m_column=t_rawColumn;
									DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2370>");
									t_doc->m_offset=t_rawIndex;
									DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2372>");
									t_current=(t_doc);
								}else{
									DBG_BLOCK();
									DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2375>");
									if((t_error)!=0){
										DBG_BLOCK();
										t_error->p_Set4(String(L"duplicate root",14),t_rawLine,t_rawColumn,t_rawIndex);
									}
									DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2376>");
									return 0;
								}
							}else{
								DBG_BLOCK();
								DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2380>");
								t_current=t_parent->p_AddChild(t_tagName,String(),String());
								DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2381>");
								t_current->m_line=t_rawLine;
								DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2382>");
								t_current->m_column=t_rawColumn;
								DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2383>");
								t_current->m_offset=t_rawIndex;
							}
							DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2387>");
							t_hasTagName=true;
						}else{
							DBG_BLOCK();
							DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2390>");
							t_tagName=t_attributeBuffer->p_value().ToLower();
							DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2393>");
							if(t_parent==0 || t_tagName!=t_parent->m_name){
								DBG_BLOCK();
								DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2395>");
								if((t_error)!=0){
									DBG_BLOCK();
									t_error->p_Set4(String(L"mismatched end tag",18),t_rawLine,t_rawColumn,t_rawIndex);
								}
								DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2396>");
								return 0;
							}
							DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2400>");
							t_waitTagClose=true;
							DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2401>");
							t_hasTagName=true;
						}
					}else{
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2404>");
						if(t_hasAttributeId==false){
							DBG_BLOCK();
							DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2406>");
							t_attributeId=t_attributeBuffer->p_value().ToLower();
							DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2407>");
							t_hasAttributeId=true;
						}else{
							DBG_BLOCK();
							DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2410>");
							t_attributeValue=t_attributeBuffer->p_value();
							DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2411>");
							t_hasAttributeValue=true;
						}
						DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2415>");
						if(t_processTag && t_hasAttributeId || t_hasAttributeId && t_hasAttributeValue || t_isSingleAttribute || t_hasTagClose){
							DBG_BLOCK();
							DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2417>");
							if(t_inFormat==false){
								DBG_BLOCK();
								DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2419>");
								t_current->p_SetAttribute5(t_attributeId,t_attributeValue);
							}else{
								DBG_BLOCK();
								DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2422>");
								String t_6=t_attributeId;
								DBG_LOCAL(t_6,"6")
								DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2423>");
								if(t_6==String(L"version",7)){
									DBG_BLOCK();
									DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2424>");
									t_formatVersion=t_attributeValue;
								}else{
									DBG_BLOCK();
									DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2425>");
									if(t_6==String(L"encoding",8)){
										DBG_BLOCK();
										DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2426>");
										t_formatEncoding=t_attributeValue;
									}
								}
							}
							DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2431>");
							t_attributeId=String();
							DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2432>");
							t_attributeValue=String();
							DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2433>");
							t_hasAttributeId=false;
							DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2434>");
							t_hasAttributeValue=false;
							DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2435>");
							t_hasEquals=false;
						}
					}
					DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2440>");
					t_attributeBuffer->p_Clear();
				}
				DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2444>");
				if(t_isSingleAttribute){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2445>");
					t_isSingleAttribute=false;
					DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2446>");
					t_attributeBuffer->p_Add4(t_rawAsc);
				}
			}
			DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2451>");
			if(t_processTag){
				DBG_BLOCK();
				DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2452>");
				t_processTag=false;
				DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2455>");
				if(t_inFormat==false){
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2458>");
					if(t_hasTagClose==false && t_isCloseSelf==false){
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2461>");
						t_parent=t_current;
						DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2462>");
						t_current=0;
						DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2465>");
						t_stack->p_AddLast13(t_parent);
					}
					DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2469>");
					if(t_isCloseSelf){
						DBG_BLOCK();
						t_hasTagClose=true;
					}
					DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2472>");
					if(t_hasTagClose==true){
						DBG_BLOCK();
						DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2474>");
						if(t_isCloseSelf==false){
							DBG_BLOCK();
							DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2477>");
							if((t_whitespaceBuffer->p_Length2())!=0){
								DBG_BLOCK();
								DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2479>");
								if((t_options&1)==1){
									DBG_BLOCK();
									DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2480>");
									t_whitespaceBuffer->p_Trim();
								}
								DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2484>");
								if((t_whitespaceBuffer->p_Length2())!=0){
									DBG_BLOCK();
									DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2485>");
									t_parent->p_AddText(t_whitespaceBuffer->p_value());
									DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2486>");
									t_whitespaceBuffer->p_Clear();
								}
							}
							DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2491>");
							t_stack->p_RemoveLast();
							DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2492>");
							if(t_stack->p_IsEmpty()){
								DBG_BLOCK();
								DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2493>");
								t_parent=0;
							}else{
								DBG_BLOCK();
								DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2495>");
								t_parent=t_stack->p_Last2();
							}
						}else{
							DBG_BLOCK();
							DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2499>");
							t_isCloseSelf=false;
						}
					}
				}else{
					DBG_BLOCK();
					DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2504>");
					t_hasFormat=true;
					DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2505>");
					t_inFormat=false;
				}
				DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2509>");
				t_inTag=false;
				DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2510>");
				t_hasTagClose=false;
				DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2511>");
				t_hasTagName=false;
				DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2512>");
				t_waitTagClose=false;
				DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2513>");
				t_tagName=String();
			}
		}
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2519>");
	if(t_inTag || ((t_parent)!=0) || t_doc==0){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2521>");
		if((t_error)!=0){
			DBG_BLOCK();
			t_error->p_Set4(String(L"unexpected end of xml",21),t_rawLine,t_rawColumn,t_rawIndex);
		}
		DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2522>");
		return 0;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/xml/xml.monkey<2525>");
	return t_doc;
}
c_Enumerator15::c_Enumerator15(){
	m__list=0;
	m__curr=0;
}
c_Enumerator15* c_Enumerator15::m_new(c_List13* t_list){
	DBG_ENTER("Enumerator.new")
	c_Enumerator15 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_list,"list")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<326>");
	gc_assign(m__list,t_list);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<327>");
	gc_assign(m__curr,t_list->m__head->m__succ);
	return this;
}
c_Enumerator15* c_Enumerator15::m_new2(){
	DBG_ENTER("Enumerator.new")
	c_Enumerator15 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<323>");
	return this;
}
bool c_Enumerator15::p_HasNext(){
	DBG_ENTER("Enumerator.HasNext")
	c_Enumerator15 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<331>");
	while(m__curr->m__succ->m__pred!=m__curr){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<332>");
		gc_assign(m__curr,m__curr->m__succ);
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<334>");
	bool t_=m__curr!=m__list->m__head;
	return t_;
}
c_XMLNode* c_Enumerator15::p_NextObject(){
	DBG_ENTER("Enumerator.NextObject")
	c_Enumerator15 *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<338>");
	c_XMLNode* t_data=m__curr->m__data;
	DBG_LOCAL(t_data,"data")
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<339>");
	gc_assign(m__curr,m__curr->m__succ);
	DBG_INFO("C:/MonkeyXPro77f/modules/monkey/list.monkey<340>");
	return t_data;
}
void c_Enumerator15::mark(){
	Object::mark();
	gc_mark_q(m__list);
	gc_mark_q(m__curr);
}
String c_Enumerator15::debug(){
	String t="(Enumerator)\n";
	t+=dbg_decl("_list",&m__list);
	t+=dbg_decl("_curr",&m__curr);
	return t;
}
int bb_tutility_Dprint(String t_x,String t_y,String t_z,String t_a,String t_b,String t_c){
	DBG_ENTER("Dprint")
	DBG_LOCAL(t_x,"x")
	DBG_LOCAL(t_y,"y")
	DBG_LOCAL(t_z,"z")
	DBG_LOCAL(t_a,"a")
	DBG_LOCAL(t_b,"b")
	DBG_LOCAL(t_c,"c")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tutility.monkey<14>");
	String t_st=t_x+String(L" ",1)+t_y+String(L" ",1)+t_z+String(L" ",1)+t_a+String(L" ",1)+t_b+String(L" ",1)+t_c;
	DBG_LOCAL(t_st,"st")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/tutility.monkey<15>");
	bbPrint(t_st);
	return 0;
}
c_PreloadData::c_PreloadData(){
	m_loaded=false;
	m_id=0;
	m_data=0;
	m_w=0;
	m_h=0;
}
c_PreloadData* c_PreloadData::m_new(){
	DBG_ENTER("PreloadData.new")
	c_PreloadData *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/opengl/tpixmapgl.monkey<323>");
	return this;
}
void c_PreloadData::mark(){
	Object::mark();
	gc_mark_q(m_data);
}
String c_PreloadData::debug(){
	String t="(PreloadData)\n";
	t+=dbg_decl("data",&m_data);
	t+=dbg_decl("w",&m_w);
	t+=dbg_decl("h",&m_h);
	t+=dbg_decl("id",&m_id);
	t+=dbg_decl("loaded",&m_loaded);
	return t;
}
c_ArrayIntMap::c_ArrayIntMap(){
	m_data=Array<c_PreloadData* >();
	m_length=0;
}
c_ArrayIntMap* c_ArrayIntMap::m_new(){
	DBG_ENTER("ArrayIntMap.new")
	c_ArrayIntMap *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/arrayintmap.monkey<8>");
	gc_assign(m_data,Array<c_PreloadData* >(32));
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/arrayintmap.monkey<9>");
	m_length=31;
	return this;
}
c_PreloadData* c_ArrayIntMap::p_Get(int t_id){
	DBG_ENTER("ArrayIntMap.Get")
	c_ArrayIntMap *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_id,"id")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/arrayintmap.monkey<22>");
	if(t_id<m_length){
		DBG_BLOCK();
		return m_data.At(t_id);
	}
	return 0;
}
void c_ArrayIntMap::p_Set7(int t_id,c_PreloadData* t_obj){
	DBG_ENTER("ArrayIntMap.Set")
	c_ArrayIntMap *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_id,"id")
	DBG_LOCAL(t_obj,"obj")
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/arrayintmap.monkey<26>");
	while(t_id>=m_length){
		DBG_BLOCK();
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/arrayintmap.monkey<27>");
		m_length=m_length+32;
		DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/arrayintmap.monkey<28>");
		gc_assign(m_data,m_data.Resize(m_length+1));
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/minib3d/math/arrayintmap.monkey<30>");
	gc_assign(m_data.At(t_id),t_obj);
}
void c_ArrayIntMap::mark(){
	Object::mark();
	gc_mark_q(m_data);
}
String c_ArrayIntMap::debug(){
	String t="(ArrayIntMap)\n";
	t+=dbg_decl("data",&m_data);
	t+=dbg_decl("length",&m_length);
	return t;
}
c_DataBuffer* bb_gles11_LoadImageData(String t_path,Array<int > t_info){
	DBG_ENTER("LoadImageData")
	DBG_LOCAL(t_path,"path")
	DBG_LOCAL(t_info,"info")
	DBG_INFO("C:/MonkeyXPro77f/modules/opengl/gles11.monkey<708>");
	c_DataBuffer* t_buf=(new c_DataBuffer)->m_new2();
	DBG_LOCAL(t_buf,"buf")
	DBG_INFO("C:/MonkeyXPro77f/modules/opengl/gles11.monkey<709>");
	if((BBLoadImageData((t_buf),t_path,t_info))!=0){
		DBG_BLOCK();
		return t_buf;
	}
	DBG_INFO("C:/MonkeyXPro77f/modules/opengl/gles11.monkey<710>");
	return 0;
}
c_AsyncSocketIoOp::c_AsyncSocketIoOp(){
	m__socket=0;
	m__data=0;
	m__offset=0;
	m__count=0;
}
c_AsyncSocketIoOp* c_AsyncSocketIoOp::m_new(BBSocket* t_socket,c_DataBuffer* t_data,int t_offset,int t_count){
	DBG_ENTER("AsyncSocketIoOp.new")
	c_AsyncSocketIoOp *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_socket,"socket")
	DBG_LOCAL(t_data,"data")
	DBG_LOCAL(t_offset,"offset")
	DBG_LOCAL(t_count,"count")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<200>");
	c_AsyncOp::m_new();
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<201>");
	gc_assign(m__socket,t_socket);
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<202>");
	gc_assign(m__data,t_data);
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<203>");
	m__offset=t_offset;
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<204>");
	m__count=t_count;
	return this;
}
c_AsyncSocketIoOp* c_AsyncSocketIoOp::m_new2(){
	DBG_ENTER("AsyncSocketIoOp.new")
	c_AsyncSocketIoOp *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<198>");
	c_AsyncOp::m_new();
	return this;
}
void c_AsyncSocketIoOp::mark(){
	c_AsyncOp::mark();
	gc_mark_q(m__socket);
	gc_mark_q(m__data);
}
String c_AsyncSocketIoOp::debug(){
	String t="(AsyncSocketIoOp)\n";
	t=c_AsyncOp::debug()+t;
	t+=dbg_decl("_socket",&m__socket);
	t+=dbg_decl("_data",&m__data);
	t+=dbg_decl("_offset",&m__offset);
	t+=dbg_decl("_count",&m__count);
	return t;
}
c_AsyncSendOp::c_AsyncSendOp(){
	m__onComplete=0;
}
c_AsyncSendOp* c_AsyncSendOp::m_new(BBSocket* t_socket,c_DataBuffer* t_data,int t_offset,int t_count,c_IOnSendComplete* t_onComplete){
	DBG_ENTER("AsyncSendOp.new")
	c_AsyncSendOp *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_socket,"socket")
	DBG_LOCAL(t_data,"data")
	DBG_LOCAL(t_offset,"offset")
	DBG_LOCAL(t_count,"count")
	DBG_LOCAL(t_onComplete,"onComplete")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<219>");
	c_AsyncSocketIoOp::m_new(t_socket,t_data,t_offset,t_count);
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<220>");
	gc_assign(m__onComplete,t_onComplete);
	return this;
}
c_AsyncSendOp* c_AsyncSendOp::m_new2(){
	DBG_ENTER("AsyncSendOp.new")
	c_AsyncSendOp *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<216>");
	c_AsyncSocketIoOp::m_new2();
	return this;
}
void c_AsyncSendOp::p_Execute__UNSAFE__(c_Socket* t_source){
	m__count=m__socket->Send((m__data),m__offset,m__count);
}
void c_AsyncSendOp::p_Complete(c_Socket* t_source){
	DBG_ENTER("AsyncSendOp.Complete")
	c_AsyncSendOp *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_source,"source")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<232>");
	m__onComplete->p_OnSendComplete(m__data,m__offset,m__count,t_source);
}
void c_AsyncSendOp::mark(){
	c_AsyncSocketIoOp::mark();
	gc_mark_q(m__onComplete);
}
String c_AsyncSendOp::debug(){
	String t="(AsyncSendOp)\n";
	t=c_AsyncSocketIoOp::debug()+t;
	t+=dbg_decl("_onComplete",&m__onComplete);
	return t;
}
c_AsyncReceiveOp::c_AsyncReceiveOp(){
	m__onComplete=0;
}
c_AsyncReceiveOp* c_AsyncReceiveOp::m_new(BBSocket* t_socket,c_DataBuffer* t_data,int t_offset,int t_count,c_IOnReceiveComplete* t_onComplete){
	DBG_ENTER("AsyncReceiveOp.new")
	c_AsyncReceiveOp *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_socket,"socket")
	DBG_LOCAL(t_data,"data")
	DBG_LOCAL(t_offset,"offset")
	DBG_LOCAL(t_count,"count")
	DBG_LOCAL(t_onComplete,"onComplete")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<263>");
	c_AsyncSocketIoOp::m_new(t_socket,t_data,t_offset,t_count);
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<264>");
	gc_assign(m__onComplete,t_onComplete);
	return this;
}
c_AsyncReceiveOp* c_AsyncReceiveOp::m_new2(){
	DBG_ENTER("AsyncReceiveOp.new")
	c_AsyncReceiveOp *self=this;
	DBG_LOCAL(self,"Self")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<260>");
	c_AsyncSocketIoOp::m_new2();
	return this;
}
void c_AsyncReceiveOp::p_Execute__UNSAFE__(c_Socket* t_source){
	m__count=m__socket->Receive((m__data),m__offset,m__count);
}
void c_AsyncReceiveOp::p_Complete(c_Socket* t_source){
	DBG_ENTER("AsyncReceiveOp.Complete")
	c_AsyncReceiveOp *self=this;
	DBG_LOCAL(self,"Self")
	DBG_LOCAL(t_source,"source")
	DBG_INFO("C:/MonkeyXPro77f/modules/brl/socket.monkey<276>");
	m__onComplete->p_OnReceiveComplete(m__data,m__offset,m__count,t_source);
}
void c_AsyncReceiveOp::mark(){
	c_AsyncSocketIoOp::mark();
	gc_mark_q(m__onComplete);
}
String c_AsyncReceiveOp::debug(){
	String t="(AsyncReceiveOp)\n";
	t=c_AsyncSocketIoOp::debug()+t;
	t+=dbg_decl("_onComplete",&m__onComplete);
	return t;
}
int bbInit(){
	GC_CTOR
	bb_app2__app=0;
	DBG_GLOBAL("_app",&bb_app2__app);
	bb_app2__delegate=0;
	DBG_GLOBAL("_delegate",&bb_app2__delegate);
	bb_app2__game=BBGame::Game();
	DBG_GLOBAL("_game",&bb_app2__game);
	bb_graphics_device=0;
	DBG_GLOBAL("device",&bb_graphics_device);
	bb_graphics_context=(new c_GraphicsContext)->m_new();
	DBG_GLOBAL("context",&bb_graphics_context);
	c_Image::m_DefaultFlags=0;
	DBG_GLOBAL("DefaultFlags",&c_Image::m_DefaultFlags);
	bb_audio_device=0;
	DBG_GLOBAL("device",&bb_audio_device);
	bb_input_device=0;
	DBG_GLOBAL("device",&bb_input_device);
	bb_app2__devWidth=0;
	DBG_GLOBAL("_devWidth",&bb_app2__devWidth);
	bb_app2__devHeight=0;
	DBG_GLOBAL("_devHeight",&bb_app2__devHeight);
	bb_app2__displayModes=Array<c_DisplayMode* >();
	DBG_GLOBAL("_displayModes",&bb_app2__displayModes);
	bb_app2__desktopMode=0;
	DBG_GLOBAL("_desktopMode",&bb_app2__desktopMode);
	bb_graphics_renderDevice=0;
	DBG_GLOBAL("renderDevice",&bb_graphics_renderDevice);
	bb_app2__updateRate=0;
	DBG_GLOBAL("_updateRate",&bb_app2__updateRate);
	c_TRender::m_render=0;
	DBG_GLOBAL("render",&c_TRender::m_render);
	c_MojoEmulationDevice::m__device=0;
	DBG_GLOBAL("_device",&c_MojoEmulationDevice::m__device);
	c_MojoEmulationDevice::m__olddevice=0;
	DBG_GLOBAL("_olddevice",&c_MojoEmulationDevice::m__olddevice);
	c_MojoEmulationDevice::m__quadCache=0;
	DBG_GLOBAL("_quadCache",&c_MojoEmulationDevice::m__quadCache);
	c_TEntity::m_entity_list=(new c_EntityList)->m_new();
	DBG_GLOBAL("entity_list",&c_TEntity::m_entity_list);
	c_TTexture::m_useGlobalResizeSmooth=true;
	DBG_GLOBAL("useGlobalResizeSmooth",&c_TTexture::m_useGlobalResizeSmooth);
	c_TRender::m_draw_list=(new c_List3)->m_new();
	DBG_GLOBAL("draw_list",&c_TRender::m_draw_list);
	c_MojoEmulationDevice::m_firstTimeRun=false;
	DBG_GLOBAL("firstTimeRun",&c_MojoEmulationDevice::m_firstTimeRun);
	c_TPixmap::m_preloader=0;
	DBG_GLOBAL("preloader",&c_TPixmap::m_preloader);
	c_Stack2::m_NIL=0;
	DBG_GLOBAL("NIL",&c_Stack2::m_NIL);
	c_MiniB3DApp::m__resumed=false;
	DBG_GLOBAL("_resumed",&c_MiniB3DApp::m__resumed);
	c_TRender::m_tris_rendered=0;
	DBG_GLOBAL("tris_rendered",&c_TRender::m_tris_rendered);
	c_TTexture::m_tex_bind_stack=(new c_TextureStack)->m_new();
	DBG_GLOBAL("tex_bind_stack",&c_TTexture::m_tex_bind_stack);
	c_Stack3::m_NIL=0;
	DBG_GLOBAL("NIL",&c_Stack3::m_NIL);
	c_TCamera::m_cam_list=(new c_EntityList2)->m_new();
	DBG_GLOBAL("cam_list",&c_TCamera::m_cam_list);
	c_TShader::m_process_list=(new c_List6)->m_new();
	DBG_GLOBAL("process_list",&c_TShader::m_process_list);
	c_TShader::m_g_shader=0;
	DBG_GLOBAL("g_shader",&c_TShader::m_g_shader);
	c_TLight::m_light_list=(new c_List7)->m_new();
	DBG_GLOBAL("light_list",&c_TLight::m_light_list);
	c_TRender::m_render_list=(new c_RenderAlphaList)->m_new();
	DBG_GLOBAL("render_list",&c_TRender::m_render_list);
	c_TRender::m_render_alpha_list=(new c_RenderAlphaList)->m_new();
	DBG_GLOBAL("render_alpha_list",&c_TRender::m_render_alpha_list);
	c_TRender::m_wireframe=0;
	DBG_GLOBAL("wireframe",&c_TRender::m_wireframe);
	c_TRender::m_temp_shader=0;
	DBG_GLOBAL("temp_shader",&c_TRender::m_temp_shader);
	c_TRender::m_shader2D=((new c_BlankShader)->m_new());
	DBG_GLOBAL("shader2D",&c_TRender::m_shader2D);
	c_ShortBuffer::m_i2f=0;
	DBG_GLOBAL("i2f",&c_ShortBuffer::m_i2f);
	c_TRender::m_alpha_pass=0;
	DBG_GLOBAL("alpha_pass",&c_TRender::m_alpha_pass);
	c_TRender::m_camera2D=(new c_TCamera)->m_new();
	DBG_GLOBAL("camera2D",&c_TRender::m_camera2D);
	c_TRender::m_width=0;
	DBG_GLOBAL("width",&c_TRender::m_width);
	c_TRender::m_height=0;
	DBG_GLOBAL("height",&c_TRender::m_height);
	c_MiniB3DApp::m__suspend=false;
	DBG_GLOBAL("_suspend",&c_MiniB3DApp::m__suspend);
	c_Thread::m__zombies=(new c_Stack5)->m_new();
	DBG_GLOBAL("_zombies",&c_Thread::m__zombies);
	c_Stack5::m_NIL=0;
	DBG_GLOBAL("NIL",&c_Stack5::m_NIL);
	c_Thread::m__zombies2=(new c_Stack5)->m_new();
	DBG_GLOBAL("_zombies2",&c_Thread::m__zombies2);
	c_Thread::m__alive=(new c_Stack5)->m_new();
	DBG_GLOBAL("_alive",&c_Thread::m__alive);
	bb_asyncevent__sources=(new c_Stack6)->m_new();
	DBG_GLOBAL("_sources",&bb_asyncevent__sources);
	c_TEntity::m_temp_mat=(new c_Matrix)->m_new();
	DBG_GLOBAL("temp_mat",&c_TEntity::m_temp_mat);
	c_TBone::m_t_mat=(new c_Matrix)->m_new();
	DBG_GLOBAL("t_mat",&c_TBone::m_t_mat);
	c_TBone::m_new_mat=(new c_Matrix)->m_new();
	DBG_GLOBAL("new_mat",&c_TBone::m_new_mat);
	c_TLight::m_no_lights=0;
	DBG_GLOBAL("no_lights",&c_TLight::m_no_lights);
	c_TLight::m_max_lights=8;
	DBG_GLOBAL("max_lights",&c_TLight::m_max_lights);
	c_TPixmap::m_manager=0;
	DBG_GLOBAL("manager",&c_TPixmap::m_manager);
	c_TText::m_mask_color=0;
	DBG_GLOBAL("mask_color",&c_TText::m_mask_color);
	c_TTextureFilter::m_filter_list=(new c_List11)->m_new();
	DBG_GLOBAL("filter_list",&c_TTextureFilter::m_filter_list);
	c_TTexture::m_tex_list=(new c_List12)->m_new();
	DBG_GLOBAL("tex_list",&c_TTexture::m_tex_list);
	bb_asyncevent__current=0;
	DBG_GLOBAL("_current",&bb_asyncevent__current);
	c_Stack6::m_NIL=0;
	DBG_GLOBAL("NIL",&c_Stack6::m_NIL);
	c_OpenglES11::m_last_texture=0;
	DBG_GLOBAL("last_texture",&c_OpenglES11::m_last_texture);
	c_OpenglES11::m_last_sprite=0;
	DBG_GLOBAL("last_sprite",&c_OpenglES11::m_last_sprite);
	c_OpenglES11::m_last_tex_count=8;
	DBG_GLOBAL("last_tex_count",&c_OpenglES11::m_last_tex_count);
	c_OpenglES11::m__useMojo=false;
	DBG_GLOBAL("_useMojo",&c_OpenglES11::m__useMojo);
	c_OpenglES11::m_alpha_list=(new c_SurfaceAlphaList)->m_new();
	DBG_GLOBAL("alpha_list",&c_OpenglES11::m_alpha_list);
	c_TRender::m_vbo_enabled=false;
	DBG_GLOBAL("vbo_enabled",&c_TRender::m_vbo_enabled);
	c_OpenglES11::m_count1280error=0;
	DBG_GLOBAL("count1280error",&c_OpenglES11::m_count1280error);
	c_TLight::m_ambient_red=FLOAT(0.1);
	DBG_GLOBAL("ambient_red",&c_TLight::m_ambient_red);
	c_TLight::m_ambient_green=FLOAT(0.1);
	DBG_GLOBAL("ambient_green",&c_TLight::m_ambient_green);
	c_TLight::m_ambient_blue=FLOAT(0.1);
	DBG_GLOBAL("ambient_blue",&c_TLight::m_ambient_blue);
	c_TRender::m_MAX_TEXTURES=3;
	DBG_GLOBAL("MAX_TEXTURES",&c_TRender::m_MAX_TEXTURES);
	c_OpenglES11::m_opengl_es=false;
	DBG_GLOBAL("opengl_es",&c_OpenglES11::m_opengl_es);
	c_TEntity::m_global_mat=(new c_Matrix)->m_new();
	DBG_GLOBAL("global_mat",&c_TEntity::m_global_mat);
	int t_[]={16384,16385,16386,16387,16388,16389,16390,16391};
	c_OpenglES11::m_gl_light=Array<int >(t_,8);
	DBG_GLOBAL("gl_light",&c_OpenglES11::m_gl_light);
	c_OpenglES11::m_light_no=0;
	DBG_GLOBAL("light_no",&c_OpenglES11::m_light_no);
	c_OpenglES11::m_old_no_lights=0;
	DBG_GLOBAL("old_no_lights",&c_OpenglES11::m_old_no_lights);
	c_MojoSurface::m_list=Array<String >(0);
	DBG_GLOBAL("list",&c_MojoSurface::m_list);
	c_MojoSurface::m_isLoading=false;
	DBG_GLOBAL("isLoading",&c_MojoSurface::m_isLoading);
	c_TSprite::m_temp_mat=(new c_Matrix)->m_new();
	DBG_GLOBAL("temp_mat",&c_TSprite::m_temp_mat);
	c_Stack4::m_NIL=String();
	DBG_GLOBAL("NIL",&c_Stack4::m_NIL);
	return 0;
}
void gc_mark(){
	gc_mark_q(bb_app2__app);
	gc_mark_q(bb_app2__delegate);
	gc_mark_q(bb_graphics_device);
	gc_mark_q(bb_graphics_context);
	gc_mark_q(bb_audio_device);
	gc_mark_q(bb_input_device);
	gc_mark_q(bb_app2__displayModes);
	gc_mark_q(bb_app2__desktopMode);
	gc_mark_q(bb_graphics_renderDevice);
	gc_mark_q(c_TRender::m_render);
	gc_mark_q(c_MojoEmulationDevice::m__device);
	gc_mark_q(c_MojoEmulationDevice::m__olddevice);
	gc_mark_q(c_MojoEmulationDevice::m__quadCache);
	gc_mark_q(c_TEntity::m_entity_list);
	gc_mark_q(c_TRender::m_draw_list);
	gc_mark_q(c_TPixmap::m_preloader);
	gc_mark_q(c_Stack2::m_NIL);
	gc_mark_q(c_TTexture::m_tex_bind_stack);
	gc_mark_q(c_Stack3::m_NIL);
	gc_mark_q(c_TCamera::m_cam_list);
	gc_mark_q(c_TShader::m_process_list);
	gc_mark_q(c_TShader::m_g_shader);
	gc_mark_q(c_TLight::m_light_list);
	gc_mark_q(c_TRender::m_render_list);
	gc_mark_q(c_TRender::m_render_alpha_list);
	gc_mark_q(c_TRender::m_temp_shader);
	gc_mark_q(c_TRender::m_shader2D);
	gc_mark_q(c_ShortBuffer::m_i2f);
	gc_mark_q(c_TRender::m_camera2D);
	gc_mark_q(c_Thread::m__zombies);
	gc_mark_q(c_Stack5::m_NIL);
	gc_mark_q(c_Thread::m__zombies2);
	gc_mark_q(c_Thread::m__alive);
	gc_mark_q(bb_asyncevent__sources);
	gc_mark_q(c_TEntity::m_temp_mat);
	gc_mark_q(c_TBone::m_t_mat);
	gc_mark_q(c_TBone::m_new_mat);
	gc_mark_q(c_TPixmap::m_manager);
	gc_mark_q(c_TTextureFilter::m_filter_list);
	gc_mark_q(c_TTexture::m_tex_list);
	gc_mark_q(bb_asyncevent__current);
	gc_mark_q(c_Stack6::m_NIL);
	gc_mark_q(c_OpenglES11::m_last_texture);
	gc_mark_q(c_OpenglES11::m_last_sprite);
	gc_mark_q(c_OpenglES11::m_alpha_list);
	gc_mark_q(c_TEntity::m_global_mat);
	gc_mark_q(c_OpenglES11::m_gl_light);
	gc_mark_q(c_MojoSurface::m_list);
	gc_mark_q(c_TSprite::m_temp_mat);
}
//${TRANSCODE_END}

int main( int argc,const char *argv[] ){

	BBMonkeyGame::Main( argc,argv );
}
